[PATCH] D128529: [InlineFunction] Only check pointer arguments for a call
ChenZheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 24 07:08:35 PDT 2022
shchenz created this revision.
shchenz added reviewers: nikic, jeroen.dobbelaere, tingwang.
Herald added a subscriber: hiraditya.
Herald added a project: All.
shchenz requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This is found from code review of D127202 <https://reviews.llvm.org/D127202>. See comment https://reviews.llvm.org/D127202#3607812
This patch does not reply on D127202 <https://reviews.llvm.org/D127202>. Making this patch depend on D127202 <https://reviews.llvm.org/D127202> is to show the improvement in the testcase.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D128529
Files:
llvm/lib/Transforms/Utils/InlineFunction.cpp
llvm/test/Transforms/Coroutines/coro-retcon-opaque-ptr.ll
llvm/test/Transforms/Coroutines/coro-retcon-resume-values.ll
llvm/test/Transforms/Coroutines/coro-retcon.ll
Index: llvm/test/Transforms/Coroutines/coro-retcon.ll
===================================================================
--- llvm/test/Transforms/Coroutines/coro-retcon.ll
+++ llvm/test/Transforms/Coroutines/coro-retcon.ll
@@ -36,8 +36,8 @@
; CHECK-LABEL: @main(
; CHECK-NEXT: entry:
; CHECK-NEXT: call void @print(i32 4)
-; CHECK-NEXT: call void @print(i32 5)
-; CHECK-NEXT: call void @print(i32 6)
+; CHECK-NEXT: call void @print(i32 5), !noalias !0
+; CHECK-NEXT: call void @print(i32 6), !noalias !3
; CHECK-NEXT: ret i32 0
;
entry:
Index: llvm/test/Transforms/Coroutines/coro-retcon-resume-values.ll
===================================================================
--- llvm/test/Transforms/Coroutines/coro-retcon-resume-values.ll
+++ llvm/test/Transforms/Coroutines/coro-retcon-resume-values.ll
@@ -66,7 +66,7 @@
; CHECK-NEXT: [[N_VAL3_RELOAD_ADDR11_I5:%.*]] = getelementptr inbounds [[F_FRAME]], %f.Frame* [[FRAMEPTR_I2]], i64 0, i32 1
; CHECK-NEXT: [[N_VAL3_RELOAD12_I6:%.*]] = load i32, i32* [[N_VAL3_RELOAD_ADDR11_I5]], align 4, !noalias !6
; CHECK-NEXT: [[SUM7_I7:%.*]] = add i32 [[N_VAL3_RELOAD12_I6]], [[INPUT_RELOAD14_I4]]
-; CHECK-NEXT: call void @print(i32 [[SUM7_I7]])
+; CHECK-NEXT: call void @print(i32 [[SUM7_I7]]), !noalias !6
; CHECK-NEXT: [[TMP5:%.*]] = bitcast %f.Frame* [[FRAMEPTR_I2]] to i8*
; CHECK-NEXT: call void @deallocate(i8* [[TMP5]]), !noalias !6
; CHECK-NEXT: ret i32 0
Index: llvm/test/Transforms/Coroutines/coro-retcon-opaque-ptr.ll
===================================================================
--- llvm/test/Transforms/Coroutines/coro-retcon-opaque-ptr.ll
+++ llvm/test/Transforms/Coroutines/coro-retcon-opaque-ptr.ll
@@ -34,8 +34,8 @@
; CHECK-LABEL: @main(
; CHECK-NEXT: entry:
; CHECK-NEXT: call void @print(i32 4)
-; CHECK-NEXT: call void @print(i32 5)
-; CHECK-NEXT: call void @print(i32 6)
+; CHECK-NEXT: call void @print(i32 5), !noalias !0
+; CHECK-NEXT: call void @print(i32 6), !noalias !3
; CHECK-NEXT: ret i32 0
;
entry:
Index: llvm/lib/Transforms/Utils/InlineFunction.cpp
===================================================================
--- llvm/lib/Transforms/Utils/InlineFunction.cpp
+++ llvm/lib/Transforms/Utils/InlineFunction.cpp
@@ -1043,12 +1043,11 @@
}
for (Value *Arg : Call->args()) {
- // We need to check the underlying objects of all arguments, not just
- // the pointer arguments, because we might be passing pointers as
- // integers, etc.
- // However, if we know that the call only accesses pointer arguments,
- // then we only need to check the pointer arguments.
- if (IsArgMemOnlyCall && !Arg->getType()->isPointerTy())
+ // Only care about pointer arguments. For a call which only accesses
+ // pointer arguments, the non-pointer arguments which may be aliased
+ // to the callee's noalias parameter after inttoptr will always do
+ // capture check below.
+ if (!Arg->getType()->isPointerTy())
continue;
PtrArgs.push_back(Arg);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128529.439733.patch
Type: text/x-patch
Size: 3136 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220624/215e6db3/attachment.bin>
More information about the llvm-commits
mailing list