mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 19:52:54 +01:00
fix a miscompilation of 176.gcc
llvm-svn: 33900
This commit is contained in:
parent
b33f883a96
commit
4402e15b4b
@ -5647,12 +5647,12 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1,
|
|||||||
if (ShiftAmt1 == ShiftAmt2) {
|
if (ShiftAmt1 == ShiftAmt2) {
|
||||||
// If we have ((X >>? C) << C), turn this into X & (-1 << C).
|
// If we have ((X >>? C) << C), turn this into X & (-1 << C).
|
||||||
if (I.getOpcode() == Instruction::Shl) {
|
if (I.getOpcode() == Instruction::Shl) {
|
||||||
uint64_t Mask = -1ULL << ShiftAmt1;
|
uint64_t Mask = Ty->getBitMask() << ShiftAmt1;
|
||||||
return BinaryOperator::createAnd(X, ConstantInt::get(Ty, Mask));
|
return BinaryOperator::createAnd(X, ConstantInt::get(Ty, Mask));
|
||||||
}
|
}
|
||||||
// If we have ((X << C) >>u C), turn this into X & (-1 >>u C).
|
// If we have ((X << C) >>u C), turn this into X & (-1 >>u C).
|
||||||
if (I.getOpcode() == Instruction::LShr) {
|
if (I.getOpcode() == Instruction::LShr) {
|
||||||
uint64_t Mask = -1ULL >> ShiftAmt1;
|
uint64_t Mask = Ty->getBitMask() >> ShiftAmt1;
|
||||||
return BinaryOperator::createAnd(X, ConstantInt::get(Ty, Mask));
|
return BinaryOperator::createAnd(X, ConstantInt::get(Ty, Mask));
|
||||||
}
|
}
|
||||||
// We can simplify ((X << C) >>s C) into a trunc + sext.
|
// We can simplify ((X << C) >>s C) into a trunc + sext.
|
||||||
|
Loading…
Reference in New Issue
Block a user