summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHaicheng Wu <haicheng@codeaurora.org>2017-01-20 16:52:22 +0000
committerHaicheng Wu <haicheng@codeaurora.org>2017-01-20 16:52:22 +0000
commit71ef5bc0ff1341f1f75c910e08f1dbaa416de2f8 (patch)
treefef7863f34626a9a2c44d66dfd961006e0c67d6c
parent41d13152b139860742dc749a4e6172c4cae22d92 (diff)
downloadbcm5719-llvm-71ef5bc0ff1341f1f75c910e08f1dbaa416de2f8.tar.gz
bcm5719-llvm-71ef5bc0ff1341f1f75c910e08f1dbaa416de2f8.zip
Revert "Recommit "[InlineCost] Use TTI to check if GEP is free." #2"
This reverts commit r292616 because the test case still has problem. llvm-svn: 292618
-rw-r--r--llvm/lib/Analysis/InlineCost.cpp20
-rw-r--r--llvm/test/Transforms/Inline/gep-cost.ll30
2 files changed, 2 insertions, 48 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index b6c3997dae3..4109049ecab 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -134,7 +134,6 @@ class CallAnalyzer : public InstVisitor<CallAnalyzer, bool> {
void accumulateSROACost(DenseMap<Value *, int>::iterator CostIt,
int InstructionCost);
bool isGEPOffsetConstant(GetElementPtrInst &GEP);
- bool isGEPFree(GetElementPtrInst &GEP);
bool accumulateGEPOffset(GEPOperator &GEP, APInt &Offset);
bool simplifyCallSite(Function *F, CallSite CS);
ConstantInt *stripAndComputeInBoundsConstantOffsets(Value *&V);
@@ -332,21 +331,6 @@ bool CallAnalyzer::accumulateGEPOffset(GEPOperator &GEP, APInt &Offset) {
return true;
}
-/// \brief Use TTI to check whether a GEP is free.
-///
-/// Respects any simplified values known during the analysis of this callsite.
-bool CallAnalyzer::isGEPFree(GetElementPtrInst &GEP) {
- SmallVector<Value *, 4> Indices;
- for (User::op_iterator I = GEP.idx_begin(), E = GEP.idx_end(); I != E; ++I)
- if (Constant *SimpleOp = SimplifiedValues.lookup(*I))
- Indices.push_back(SimpleOp);
- else
- Indices.push_back(*I);
- return TargetTransformInfo::TCC_Free ==
- TTI.getGEPCost(GEP.getSourceElementType(), GEP.getPointerOperand(),
- Indices);
-}
-
bool CallAnalyzer::visitAlloca(AllocaInst &I) {
// Check whether inlining will turn a dynamic alloca into a static
// alloca and handle that case.
@@ -412,7 +396,7 @@ bool CallAnalyzer::visitGetElementPtr(GetElementPtrInst &I) {
// Non-constant GEPs aren't folded, and disable SROA.
if (SROACandidate)
disableSROA(CostIt);
- return isGEPFree(I);
+ return false;
}
// Add the result as a new mapping to Base + Offset.
@@ -438,7 +422,7 @@ bool CallAnalyzer::visitGetElementPtr(GetElementPtrInst &I) {
// Variable GEPs will require math and will disable SROA.
if (SROACandidate)
disableSROA(CostIt);
- return isGEPFree(I);
+ return false;
}
bool CallAnalyzer::visitBitCast(BitCastInst &I) {
diff --git a/llvm/test/Transforms/Inline/gep-cost.ll b/llvm/test/Transforms/Inline/gep-cost.ll
deleted file mode 100644
index 204958f082d..00000000000
--- a/llvm/test/Transforms/Inline/gep-cost.ll
+++ /dev/null
@@ -1,30 +0,0 @@
-; REQUIRES: asserts
-; RUN: opt -inline -mtriple=aarch64--linux-gnu -mcpu=kryo -S -debug-only=inline-cost < %s 2>&1 | FileCheck %s
-
-target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
-target triple = "aarch64--linux-gnu"
-
-define void @outer([4 x i32]* %ptr, i32 %i) {
- call void @inner1([4 x i32]* %ptr, i32 %i)
- call void @inner2([4 x i32]* %ptr, i32 %i)
- ret void
-}
-; The gep in inner1() is reg+reg, which is a legal addressing mode for AArch64.
-; Thus, both the gep and ret can be simplified.
-; CHECK: Analyzing call of inner1
-; CHECK: NumInstructionsSimplified: 2
-; CHECK: NumInstructions: 2
-define void @inner1([4 x i32]* %ptr, i32 %i) {
- %G = getelementptr inbounds [4 x i32], [4 x i32]* %ptr, i32 0, i32 %i
- ret void
-}
-
-; The gep in inner2() is reg+imm+reg, which is not a legal addressing mode for
-; AArch64. Thus, only the ret can be simplified and not the gep.
-; CHECK: Analyzing call of inner2
-; CHECK: NumInstructionsSimplified: 1
-; CHECK: NumInstructions: 2
-define void @inner2([4 x i32]* %ptr, i32 %i) {
- %G = getelementptr inbounds [4 x i32], [4 x i32]* %ptr, i32 1, i32 %i
- ret void
-}
OpenPOWER on IntegriCloud