diff options
author | Sanjay Patel <spatel@rotateright.com> | 2018-09-10 18:37:59 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2018-09-10 18:37:59 +0000 |
commit | 691d1a40e28087d46e2e7876f9b6ddcd835604db (patch) | |
tree | 6e39deaf84f074af0208b7e73de292c568210617 /llvm | |
parent | 860bafa07d7be231a35472bfd71b5e5ca28ae5a2 (diff) | |
download | bcm5719-llvm-691d1a40e28087d46e2e7876f9b6ddcd835604db.tar.gz bcm5719-llvm-691d1a40e28087d46e2e7876f9b6ddcd835604db.zip |
[InstCombine] use SelectInst operand names to make code clearer; NFC
Cleanup step for D51433.
llvm-svn: 341850
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp index c5fe5561c0b..78de6dfe7f4 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp @@ -1260,13 +1260,15 @@ Value *InstCombiner::SimplifyDemandedVectorElts(Value *V, APInt DemandedElts, break; } case Instruction::Select: { + SelectInst *Sel = cast<SelectInst>(I); + Value *Cond = Sel->getCondition(); + APInt DemandedLHS(DemandedElts), DemandedRHS(DemandedElts); - if (auto *CV = dyn_cast<ConstantVector>(I->getOperand(0))) { + if (auto *CV = dyn_cast<ConstantVector>(Cond)) { for (unsigned i = 0; i < VWidth; i++) { + // isNullValue() always returns false when called on a ConstantExpr. + // Skip constant expressions to avoid propagating incorrect information. Constant *CElt = CV->getAggregateElement(i); - // Method isNullValue always returns false when called on a - // ConstantExpr. If CElt is a ConstantExpr then skip it in order to - // to avoid propagating incorrect information. if (isa<ConstantExpr>(CElt)) continue; if (CElt->isNullValue()) @@ -1276,15 +1278,15 @@ Value *InstCombiner::SimplifyDemandedVectorElts(Value *V, APInt DemandedElts, } } - if (Value *V = SimplifyDemandedVectorElts(I->getOperand(1), DemandedLHS, + if (Value *V = SimplifyDemandedVectorElts(Sel->getTrueValue(), DemandedLHS, UndefElts2, Depth + 1)) { - I->setOperand(1, V); + Sel->setTrueValue(V); MadeChange = true; } - if (Value *V = SimplifyDemandedVectorElts(I->getOperand(2), DemandedRHS, + if (Value *V = SimplifyDemandedVectorElts(Sel->getFalseValue(), DemandedRHS, UndefElts3, Depth + 1)) { - I->setOperand(2, V); + Sel->setFalseValue(V); MadeChange = true; } |