Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit d1af97c

Browse files
author
Haicheng Wu
committed
Revert "Recommit "[InlineCost] Use TTI to check if GEP is free." #2"
This reverts commit r292616 because the test case still has problem. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292618 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent bdcefb6 commit d1af97c

File tree

2 files changed

+2
-48
lines changed

2 files changed

+2
-48
lines changed

lib/Analysis/InlineCost.cpp

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ class CallAnalyzer : public InstVisitor<CallAnalyzer, bool> {
134134
void accumulateSROACost(DenseMap<Value *, int>::iterator CostIt,
135135
int InstructionCost);
136136
bool isGEPOffsetConstant(GetElementPtrInst &GEP);
137-
bool isGEPFree(GetElementPtrInst &GEP);
138137
bool accumulateGEPOffset(GEPOperator &GEP, APInt &Offset);
139138
bool simplifyCallSite(Function *F, CallSite CS);
140139
ConstantInt *stripAndComputeInBoundsConstantOffsets(Value *&V);
@@ -332,21 +331,6 @@ bool CallAnalyzer::accumulateGEPOffset(GEPOperator &GEP, APInt &Offset) {
332331
return true;
333332
}
334333

335-
/// \brief Use TTI to check whether a GEP is free.
336-
///
337-
/// Respects any simplified values known during the analysis of this callsite.
338-
bool CallAnalyzer::isGEPFree(GetElementPtrInst &GEP) {
339-
SmallVector<Value *, 4> Indices;
340-
for (User::op_iterator I = GEP.idx_begin(), E = GEP.idx_end(); I != E; ++I)
341-
if (Constant *SimpleOp = SimplifiedValues.lookup(*I))
342-
Indices.push_back(SimpleOp);
343-
else
344-
Indices.push_back(*I);
345-
return TargetTransformInfo::TCC_Free ==
346-
TTI.getGEPCost(GEP.getSourceElementType(), GEP.getPointerOperand(),
347-
Indices);
348-
}
349-
350334
bool CallAnalyzer::visitAlloca(AllocaInst &I) {
351335
// Check whether inlining will turn a dynamic alloca into a static
352336
// alloca and handle that case.
@@ -412,7 +396,7 @@ bool CallAnalyzer::visitGetElementPtr(GetElementPtrInst &I) {
412396
// Non-constant GEPs aren't folded, and disable SROA.
413397
if (SROACandidate)
414398
disableSROA(CostIt);
415-
return isGEPFree(I);
399+
return false;
416400
}
417401

418402
// Add the result as a new mapping to Base + Offset.
@@ -438,7 +422,7 @@ bool CallAnalyzer::visitGetElementPtr(GetElementPtrInst &I) {
438422
// Variable GEPs will require math and will disable SROA.
439423
if (SROACandidate)
440424
disableSROA(CostIt);
441-
return isGEPFree(I);
425+
return false;
442426
}
443427

444428
bool CallAnalyzer::visitBitCast(BitCastInst &I) {

test/Transforms/Inline/gep-cost.ll

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)