Skip to content

Commit 9146879

Browse files
committed
ConstraintElim: function args have trivial decomp
1 parent f0d674c commit 9146879

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

llvm/lib/Transforms/Scalar/ConstraintElimination.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,7 +1704,7 @@ static void dryRunAddFact(CmpInst::Predicate Pred, Value *A, Value *B,
17041704
// We abuse the Value2Index map by storing a map of Value -> size of
17051705
// decompose(Value).Vars. We do this to avoid wastefully calling decompose
17061706
// on chains we have already seen.
1707-
auto &DecompSizes = Info.getValue2Index(IsSigned);
1707+
auto &DecompSizes = Info.getValue2Index(true);
17081708
const auto &DL = Info.getDataLayout();
17091709

17101710
auto GetDecompSize = [&DL, &DecompSizes, IsSigned](Value *V) {
@@ -1777,9 +1777,18 @@ dryRun(Function &F, DominatorTree &DT, LoopInfo &LI, ScalarEvolution &SE) {
17771777
// EstimatedRowsA corresponds to SignedCS, and EstimatedRowsB corresponds to
17781778
// UnsignedCS.
17791779
unsigned EstimatedRowsA = 0, EstimatedRowsB = 1;
1780-
unsigned EstimatedColumns = 1;
1780+
unsigned EstimatedColumns = F.arg_end() - F.arg_begin() + 1;
17811781
ConstraintInfo Info(F.getDataLayout(), {});
17821782

1783+
// We abuse the Value2Index map by storing a map of Value -> size of
1784+
// decompose(Value).Vars. We do this to avoid wastefully calling decompose
1785+
// on chains we have already seen.
1786+
//
1787+
// Function arguments don't decompose into anything non-trivial.
1788+
auto &DecompSizes = Info.getValue2Index(true);
1789+
for (Value &A : F.args())
1790+
DecompSizes.insert({&A, 1});
1791+
17831792
// First, collect conditions implied by branches and blocks with their
17841793
// Dominator DFS in and out numbers.
17851794
for (BasicBlock &BB : F) {

0 commit comments

Comments
 (0)