[llvm] 39a4505 - Revert "[InlineCost] GetElementPtr with constant operands"
Kirill Naumov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 17 07:03:06 PDT 2020
Author: Kirill Naumov
Date: 2020-06-17T14:02:18Z
New Revision: 39a4505e34387d9e9165127a4f2fd64223f1d833
URL: https://github.com/llvm/llvm-project/commit/39a4505e34387d9e9165127a4f2fd64223f1d833
DIFF: https://github.com/llvm/llvm-project/commit/39a4505e34387d9e9165127a4f2fd64223f1d833.diff
LOG: Revert "[InlineCost] GetElementPtr with constant operands"
This reverts commit 34fba68d80051e3c53e7843157c036f6d511ae03.
Added:
Modified:
llvm/lib/Analysis/InlineCost.cpp
Removed:
llvm/test/Transforms/Inline/gep_from_constant.ll
################################################################################
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index 38e7160e0904..0afc88d71863 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -110,10 +110,6 @@ static cl::opt<bool> InlineCallerSupersetNoBuiltin(
cl::desc("Allow inlining when caller has a superset of callee's nobuiltin "
"attributes."));
-static cl::opt<bool> DisableGEPConstOperand(
- "disable-gep-const-evaluation", cl::Hidden, cl::init(false),
- cl::desc("Disables evaluation of GetElementPtr with constant operands"));
-
namespace {
class InlineCostCallAnalyzer;
@@ -1007,16 +1003,6 @@ bool CallAnalyzer::visitGetElementPtr(GetElementPtrInst &I) {
return true;
};
- if (!DisableGEPConstOperand)
- if (simplifyInstruction(I, [&](SmallVectorImpl<Constant *> &COps) {
- SmallVector<Constant *, 2> Indices;
- for (unsigned int Index = 1 ; Index < COps.size() ; ++Index)
- Indices.push_back(COps[Index]);
- return ConstantExpr::getGetElementPtr(I.getSourceElementType(), COps[0],
- Indices, I.isInBounds());
- }))
- return true;
-
if ((I.isInBounds() && canFoldInboundsGEP(I)) || IsGEPOffsetConstant(I)) {
if (SROAArg)
SROAArgValues[&I] = SROAArg;
diff --git a/llvm/test/Transforms/Inline/gep_from_constant.ll b/llvm/test/Transforms/Inline/gep_from_constant.ll
deleted file mode 100644
index eafb4710690b..000000000000
--- a/llvm/test/Transforms/Inline/gep_from_constant.ll
+++ /dev/null
@@ -1,15 +0,0 @@
-; RUN: opt < %s -passes="print<inline-cost>" 2>&1 | FileCheck %s
-
-; CHECK-LABEL: @foo
-; CHECK: cost before = {{.*}}, cost after = {{.*}}, threshold before = {{.*}}, threshold after = {{.*}}, cost delta = {{.*}}, simplified to i8 addrspace(1)** getelementptr (i8 addrspace(1)*, i8 addrspace(1)** inttoptr (i64 754974720 to i8 addrspace(1)**), i64 5)
-
-define i8 addrspace(1)** @foo(i64 %0) {
- %2 = inttoptr i64 754974720 to i8 addrspace(1)**
- %3 = getelementptr i8 addrspace(1)*, i8 addrspace(1)** %2, i64 %0
- ret i8 addrspace(1)** %3
-}
-
-define i8 addrspace(1)** @main() {
- %1 = call i8 addrspace(1)** @foo(i64 5)
- ret i8 addrspace(1)** %1
-}
More information about the llvm-commits
mailing list