summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2017-04-12 18:25:25 +0000
committerCraig Topper <craig.topper@gmail.com>2017-04-12 18:25:25 +0000
commitf35a7f7b4963009fac8bb6c66610d5b7e9d5f01b (patch)
tree2a47393aca12ff3cc8c317ce2f383f675391a862
parent9a51c7f343447768bdfeb4f15c4c16c6c98be975 (diff)
downloadbcm5719-llvm-f35a7f7b4963009fac8bb6c66610d5b7e9d5f01b.tar.gz
bcm5719-llvm-f35a7f7b4963009fac8bb6c66610d5b7e9d5f01b.zip
[InstCombine] In SimplifyMultipleUseDemandedBits, use a switch instead of cascaded ifs on opcode. NFC
llvm-svn: 300085
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
index 279f44c2eae..ae214d8bdf5 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
@@ -766,7 +766,8 @@ Value *InstCombiner::SimplifyMultipleUseDemandedBits(Instruction *I,
// context, we can at least compute the knownzero/knownone bits, and we can
// do simplifications that apply to *just* the one user if we know that
// this instruction has a simpler value in that context.
- if (I->getOpcode() == Instruction::And) {
+ switch (I->getOpcode()) {
+ case Instruction::And:
// If either the LHS or the RHS are Zero, the result is zero.
computeKnownBits(I->getOperand(1), RHSKnownZero, RHSKnownOne, Depth + 1,
CxtI);
@@ -787,7 +788,9 @@ Value *InstCombiner::SimplifyMultipleUseDemandedBits(Instruction *I,
if ((DemandedMask & (RHSKnownZero|LHSKnownZero)) == DemandedMask)
return Constant::getNullValue(ITy);
- } else if (I->getOpcode() == Instruction::Or) {
+ break;
+
+ case Instruction::Or:
// We can simplify (X|Y) -> X or Y in the user's context if we know that
// only bits from X or Y are demanded.
@@ -815,7 +818,10 @@ Value *InstCombiner::SimplifyMultipleUseDemandedBits(Instruction *I,
if ((DemandedMask & (~LHSKnownZero) & RHSKnownOne) ==
(DemandedMask & (~LHSKnownZero)))
return I->getOperand(1);
- } else if (I->getOpcode() == Instruction::Xor) {
+
+ break;
+
+ case Instruction::Xor:
// We can simplify (X^Y) -> X or Y in the user's context if we know that
// only bits from X or Y are demanded.
@@ -830,6 +836,8 @@ Value *InstCombiner::SimplifyMultipleUseDemandedBits(Instruction *I,
return I->getOperand(0);
if ((DemandedMask & LHSKnownZero) == DemandedMask)
return I->getOperand(1);
+
+ break;
}
// Compute the KnownZero/KnownOne bits to simplify things downstream.
OpenPOWER on IntegriCloud