[llvm] 0e2b4b2 - Revert "[ArgumentPromotion] Bail if any callers are minsize"
Shoaib Meenai via llvm-commits
llvm-commits at lists.llvm.org
Fri May 5 14:27:26 PDT 2023
Author: Shoaib Meenai
Date: 2023-05-05T14:26:57-07:00
New Revision: 0e2b4b2dbac3ae878098003940274d3396b46e18
URL: https://github.com/llvm/llvm-project/commit/0e2b4b2dbac3ae878098003940274d3396b46e18
DIFF: https://github.com/llvm/llvm-project/commit/0e2b4b2dbac3ae878098003940274d3396b46e18.diff
LOG: Revert "[ArgumentPromotion] Bail if any callers are minsize"
This reverts commit 8b8466fd31e5a194fd8ba7a73a0f23d32f164318.
This is causing size regressions with -Oz and FullLTO. Revert while I
come up with a repro.
Added:
Modified:
llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
Removed:
llvm/test/Transforms/ArgumentPromotion/minsize.ll
################################################################################
diff --git a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
index 6d0cd21cbe92f..8c6c0728097ca 100644
--- a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -764,15 +764,6 @@ static Function *promoteArguments(Function *F, FunctionAnalysisManager &FAM,
if (CB->isMustTailCall())
return nullptr;
- // If the caller is marked minsize, this transformation may increase code
- // size. We assume that there is more than one call to this function since
- // otherwise this function would be inlined or is dead.
- // TODO: compare the number of loads/stores removed from the function with
- // the number of introduced loads in callees to see if this is profitable
- // code-size-wise.
- if (CB->getFunction()->hasMinSize())
- return nullptr;
-
if (CB->getFunction() == F)
IsRecursive = true;
}
diff --git a/llvm/test/Transforms/ArgumentPromotion/minsize.ll b/llvm/test/Transforms/ArgumentPromotion/minsize.ll
deleted file mode 100644
index 7657c557d9e4a..0000000000000
--- a/llvm/test/Transforms/ArgumentPromotion/minsize.ll
+++ /dev/null
@@ -1,63 +0,0 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
-; RUN: opt -passes=argpromotion -S < %s | FileCheck %s
-
-define internal i32 @f1(ptr %p) {
-; CHECK-LABEL: define internal i32 @f1
-; CHECK-SAME: (i32 [[P_0_VAL:%.*]]) {
-; CHECK-NEXT: ret i32 [[P_0_VAL]]
-;
- %i = load i32, ptr %p
- ret i32 %i
-}
-
-define i32 @g1(ptr %p) {
-; CHECK-LABEL: define i32 @g1
-; CHECK-SAME: (ptr [[P:%.*]]) {
-; CHECK-NEXT: [[P_VAL:%.*]] = load i32, ptr [[P]], align 4
-; CHECK-NEXT: [[I:%.*]] = call i32 @f1(i32 [[P_VAL]])
-; CHECK-NEXT: ret i32 [[I]]
-;
- %i = call i32 @f1(ptr %p)
- ret i32 %i
-}
-
-define i32 @g2(ptr %p) {
-; CHECK-LABEL: define i32 @g2
-; CHECK-SAME: (ptr [[P:%.*]]) {
-; CHECK-NEXT: [[P_VAL:%.*]] = load i32, ptr [[P]], align 4
-; CHECK-NEXT: [[I:%.*]] = call i32 @f1(i32 [[P_VAL]])
-; CHECK-NEXT: ret i32 [[I]]
-;
- %i = call i32 @f1(ptr %p)
- ret i32 %i
-}
-
-define internal i32 @f2(ptr %p) {
-; CHECK-LABEL: define internal i32 @f2
-; CHECK-SAME: (ptr [[P:%.*]]) {
-; CHECK-NEXT: [[I:%.*]] = load i32, ptr [[P]], align 4
-; CHECK-NEXT: ret i32 [[I]]
-;
- %i = load i32, ptr %p
- ret i32 %i
-}
-
-define i32 @h1(ptr %p) minsize {
-; CHECK-LABEL: define i32 @h1
-; CHECK-SAME: (ptr [[P:%.*]]) #[[ATTR0:[0-9]+]] {
-; CHECK-NEXT: [[I:%.*]] = call i32 @f2(ptr [[P]])
-; CHECK-NEXT: ret i32 [[I]]
-;
- %i = call i32 @f2(ptr %p)
- ret i32 %i
-}
-
-define i32 @h2(ptr %p) {
-; CHECK-LABEL: define i32 @h2
-; CHECK-SAME: (ptr [[P:%.*]]) {
-; CHECK-NEXT: [[I:%.*]] = call i32 @f2(ptr [[P]])
-; CHECK-NEXT: ret i32 [[I]]
-;
- %i = call i32 @f2(ptr %p)
- ret i32 %i
-}
More information about the llvm-commits
mailing list