For PR1066:
Fix this by ensuring that a bitcast is inserted to do sign switching. This is only temporarily needed as the merging of signed and unsigned is next on the SignlessTypes plate. llvm-svn: 32757
This commit is contained in:
parent
910f23f7d7
commit
193df25eb9
|
@ -2002,8 +2002,14 @@ Instruction *InstCombiner::visitSub(BinaryOperator &I) {
|
||||||
if (CU->getZExtValue() ==
|
if (CU->getZExtValue() ==
|
||||||
SI->getType()->getPrimitiveSizeInBits()-1) {
|
SI->getType()->getPrimitiveSizeInBits()-1) {
|
||||||
// Ok, the transformation is safe. Insert AShr.
|
// Ok, the transformation is safe. Insert AShr.
|
||||||
return new ShiftInst(Instruction::AShr, SI->getOperand(0),
|
// FIXME: Once integer types are signless, this cast should be
|
||||||
CU, SI->getName());
|
// removed.
|
||||||
|
Value *ShiftOp = SI->getOperand(0);
|
||||||
|
if (ShiftOp->getType() != I.getType())
|
||||||
|
ShiftOp = InsertCastBefore(Instruction::BitCast, ShiftOp,
|
||||||
|
I.getType(), I);
|
||||||
|
return new ShiftInst(Instruction::AShr, ShiftOp, CU,
|
||||||
|
SI->getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue