1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

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:
Reid Spencer 2006-12-24 00:40:59 +00:00
parent a4415de894
commit 66a349efb1

View File

@ -2002,8 +2002,14 @@ Instruction *InstCombiner::visitSub(BinaryOperator &I) {
if (CU->getZExtValue() ==
SI->getType()->getPrimitiveSizeInBits()-1) {
// Ok, the transformation is safe. Insert AShr.
return new ShiftInst(Instruction::AShr, SI->getOperand(0),
CU, SI->getName());
// FIXME: Once integer types are signless, this cast should be
// 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());
}
}
}