[llvm] r341545 - [InstCombine] fix formatting in SimplifyDemandedVectorElts->Select; NFCI
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 6 06:19:22 PDT 2018
Author: spatel
Date: Thu Sep 6 06:19:22 2018
New Revision: 341545
URL: http://llvm.org/viewvc/llvm-project?rev=341545&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp?rev=341545&r1=341544&r2=341545&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp Thu Sep 6 06:19:22 2018
@@ -1260,8 +1260,8 @@ Value *InstCombiner::SimplifyDemandedVec
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::SimplifyDemandedVec
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: {
More information about the llvm-commits
mailing list