summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2018-09-06 13:19:22 +0000
committerSanjay Patel <spatel@rotateright.com>2018-09-06 13:19:22 +0000
commit1a00ffd65636215a534738c84d08c37d6e4dacc6 (patch)
tree6259a74f7c60ec1e62fe45f6ca05601dcc2ab7c0 /llvm/lib
parentafbf31854dc9acf2efb3cd3ec1fdcc8318dff8d9 (diff)
downloadbcm5719-llvm-1a00ffd65636215a534738c84d08c37d6e4dacc6.tar.gz
bcm5719-llvm-1a00ffd65636215a534738c84d08c37d6e4dacc6.zip
[InstCombine] fix formatting in SimplifyDemandedVectorElts->Select; NFCI
I'm preparing to add the same functionality both here and to the DAG version of this code in D51696 / D51433, so try to make those cases as similar as possible to avoid bugs. llvm-svn: 341545
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
index 425f5ce384b..c5fe5561c0b 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
@@ -1260,8 +1260,8 @@ Value *InstCombiner::SimplifyDemandedVectorElts(Value *V, APInt DemandedElts,
break;
}
case Instruction::Select: {
- APInt LeftDemanded(DemandedElts), RightDemanded(DemandedElts);
- if (ConstantVector* CV = dyn_cast<ConstantVector>(I->getOperand(0))) {
+ APInt DemandedLHS(DemandedElts), DemandedRHS(DemandedElts);
+ if (auto *CV = dyn_cast<ConstantVector>(I->getOperand(0))) {
for (unsigned i = 0; i < VWidth; i++) {
Constant *CElt = CV->getAggregateElement(i);
// Method isNullValue always returns false when called on a
@@ -1270,22 +1270,26 @@ Value *InstCombiner::SimplifyDemandedVectorElts(Value *V, APInt DemandedElts,
if (isa<ConstantExpr>(CElt))
continue;
if (CElt->isNullValue())
- LeftDemanded.clearBit(i);
+ DemandedLHS.clearBit(i);
else
- RightDemanded.clearBit(i);
+ DemandedRHS.clearBit(i);
}
}
- TmpV = SimplifyDemandedVectorElts(I->getOperand(1), LeftDemanded, UndefElts,
- Depth + 1);
- if (TmpV) { I->setOperand(1, TmpV); MadeChange = true; }
+ if (Value *V = SimplifyDemandedVectorElts(I->getOperand(1), DemandedLHS,
+ UndefElts2, Depth + 1)) {
+ I->setOperand(1, V);
+ MadeChange = true;
+ }
- TmpV = SimplifyDemandedVectorElts(I->getOperand(2), RightDemanded,
- UndefElts2, Depth + 1);
- if (TmpV) { I->setOperand(2, TmpV); MadeChange = true; }
+ if (Value *V = SimplifyDemandedVectorElts(I->getOperand(2), DemandedRHS,
+ UndefElts3, Depth + 1)) {
+ I->setOperand(2, V);
+ MadeChange = true;
+ }
- // Output elements are undefined if both are undefined.
- UndefElts &= UndefElts2;
+ // Output elements are undefined if the element from each arm is undefined.
+ UndefElts = UndefElts2 & UndefElts3;
break;
}
case Instruction::BitCast: {
OpenPOWER on IntegriCloud