Fix Transforms/InstCombine/2006-02-07-SextZextCrash.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26040 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2006-02-07 19:07:40 +00:00
parent 78ee0added
commit d89d888cc5

View File

@ -563,10 +563,12 @@ bool InstCombiner::SimplifyDemandedBits(Value *V, uint64_t Mask,
// extend instead of a sign extend.
if ((Mask & ((1ULL << SrcBits)-1)) == 0) {
// Convert to unsigned first.
Value *NewVal;
Instruction *NewVal;
NewVal = new CastInst(I->getOperand(0), SrcTy->getUnsignedVersion(),
I->getOperand(0)->getName(), I);
NewVal = new CastInst(I->getOperand(0), I->getType(), I->getName());
I->getOperand(0)->getName());
InsertNewInstBefore(NewVal, *I);
NewVal = new CastInst(NewVal, I->getType(), I->getName());
InsertNewInstBefore(NewVal, *I);
return UpdateValueUsesWith(I, NewVal);
}