summaryrefslogtreecommitdiff
path: root/lib/Transforms/InstCombine
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-08-17 19:33:52 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-08-17 19:33:52 +0000
commita7fe922b98bb45be7dce7c1cfe668ec27eeddc74 (patch)
treee9648f5bddc775b842e53141d7c9748482f7115a /lib/Transforms/InstCombine
parentc3aee98e721333f265a88d6bf348e6e468f027d4 (diff)
Notes
Diffstat (limited to 'lib/Transforms/InstCombine')
-rw-r--r--lib/Transforms/InstCombine/InstCombineSelect.cpp5
-rw-r--r--lib/Transforms/InstCombine/InstructionCombining.cpp9
2 files changed, 10 insertions, 4 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineSelect.cpp b/lib/Transforms/InstCombine/InstCombineSelect.cpp
index d7eed790e2ab..8f1ff8ac0e66 100644
--- a/lib/Transforms/InstCombine/InstCombineSelect.cpp
+++ b/lib/Transforms/InstCombine/InstCombineSelect.cpp
@@ -553,8 +553,11 @@ Instruction *InstCombiner::visitSelectInstWithICmp(SelectInst &SI,
}
}
+ // FIXME: This code is nearly duplicated in InstSimplify. Using/refactoring
+ // decomposeBitTestICmp() might help.
{
- unsigned BitWidth = DL.getTypeSizeInBits(TrueVal->getType());
+ unsigned BitWidth =
+ DL.getTypeSizeInBits(TrueVal->getType()->getScalarType());
APInt MinSignedValue = APInt::getSignBit(BitWidth);
Value *X;
const APInt *Y, *C;
diff --git a/lib/Transforms/InstCombine/InstructionCombining.cpp b/lib/Transforms/InstCombine/InstructionCombining.cpp
index 51c3262b5d14..377ccb9c37f7 100644
--- a/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -2830,7 +2830,8 @@ bool InstCombiner::run() {
// Add operands to the worklist.
replaceInstUsesWith(*I, C);
++NumConstProp;
- eraseInstFromFunction(*I);
+ if (isInstructionTriviallyDead(I, TLI))
+ eraseInstFromFunction(*I);
MadeIRChange = true;
continue;
}
@@ -2851,7 +2852,8 @@ bool InstCombiner::run() {
// Add operands to the worklist.
replaceInstUsesWith(*I, C);
++NumConstProp;
- eraseInstFromFunction(*I);
+ if (isInstructionTriviallyDead(I, TLI))
+ eraseInstFromFunction(*I);
MadeIRChange = true;
continue;
}
@@ -3007,7 +3009,8 @@ static bool AddReachableCodeToWorklist(BasicBlock *BB, const DataLayout &DL,
<< *Inst << '\n');
Inst->replaceAllUsesWith(C);
++NumConstProp;
- Inst->eraseFromParent();
+ if (isInstructionTriviallyDead(Inst, TLI))
+ Inst->eraseFromParent();
continue;
}