Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[ObjC][ProvenanceEval] Only evaluate pointers #136876

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 2, 2025
Merged

Conversation

nikic
Copy link
Contributor

@nikic nikic commented Apr 23, 2025

I believe this pass should only be calling PA.related() on pointer arguments -- the operation is not really meaningful for non-pointers.

I've adjusted the test to use ptr loads instead of i8 loads, which I believe aligns with how these special globals would actually be used, and which is probably what this was intending to test.

Ran into this while trying to eliminate illegal non-pointer AA queries.

I believe this pass should only be calling PA.related() on pointer
arguments -- the operation is not really meaningful for non-pointers.

I've adjusted the test to use ptr loads instead of i8 loads, which
I believe aligns with how these special globals would actually be
used, and which is probably what this was intending to test.

Ran into this while trying to eliminate illegal non-pointer AA queries.
@llvmbot
Copy link
Member

llvmbot commented Apr 23, 2025

@llvm/pr-subscribers-llvm-transforms

Author: Nikita Popov (nikic)

Changes

I believe this pass should only be calling PA.related() on pointer arguments -- the operation is not really meaningful for non-pointers.

I've adjusted the test to use ptr loads instead of i8 loads, which I believe aligns with how these special globals would actually be used, and which is probably what this was intending to test.

Ran into this while trying to eliminate illegal non-pointer AA queries.


Full diff: https://github.com/llvm/llvm-project/pull/136876.diff

2 Files Affected:

  • (modified) llvm/lib/Transforms/ObjCARC/ProvenanceAnalysisEvaluator.cpp (+2)
  • (modified) llvm/test/Transforms/ObjCARC/provenance.ll (+15-15)
diff --git a/llvm/lib/Transforms/ObjCARC/ProvenanceAnalysisEvaluator.cpp b/llvm/lib/Transforms/ObjCARC/ProvenanceAnalysisEvaluator.cpp
index e563ecfb16228..8906fb87147a2 100644
--- a/llvm/lib/Transforms/ObjCARC/ProvenanceAnalysisEvaluator.cpp
+++ b/llvm/lib/Transforms/ObjCARC/ProvenanceAnalysisEvaluator.cpp
@@ -27,6 +27,8 @@ static StringRef getName(Value *V) {
 static void insertIfNamed(SetVector<Value *> &Values, Value *V) {
   if (!V->hasName())
     return;
+  if (!V->getType()->isPointerTy())
+    return;
   Values.insert(V);
 }
 
diff --git a/llvm/test/Transforms/ObjCARC/provenance.ll b/llvm/test/Transforms/ObjCARC/provenance.ll
index 4e54f2771e6b3..5dac39c6a43ce 100644
--- a/llvm/test/Transforms/ObjCARC/provenance.ll
+++ b/llvm/test/Transforms/ObjCARC/provenance.ll
@@ -7,32 +7,32 @@
 @g4 = global i8 0, section "__TEXT,__objc_methname,cstring_literals"
 @g5 = global i8 0, section "__TEXT,__cstring,cstring_literals"
 
-declare void @g(i8)
+declare void @g(ptr)
 
 define void @f(ptr %a, ptr %b, ptr %c) {
-  %y1 = load i8, ptr %a
-  call void @g(i8 %y1)
+  %y1 = load ptr, ptr %a
+  call void @g(ptr %y1)
 
   %y2 = load ptr, ptr %b
   %y3 = load ptr, ptr %c
 
-  %x0 = load i8, ptr @"\01l_objc_msgSend_fixup_"
-  call void @g(i8 %x0)
+  %x0 = load ptr, ptr @"\01l_objc_msgSend_fixup_"
+  call void @g(ptr %x0)
 
-  %x1 = load i8, ptr @g1
-  call void @g(i8 %x1)
+  %x1 = load ptr, ptr @g1
+  call void @g(ptr %x1)
 
-  %x2 = load i8, ptr @g2
-  call void @g(i8 %x2)
+  %x2 = load ptr, ptr @g2
+  call void @g(ptr %x2)
 
-  %x3 = load i8, ptr @g3
-  call void @g(i8 %x3)
+  %x3 = load ptr, ptr @g3
+  call void @g(ptr %x3)
 
-  %x4 = load i8, ptr @g4
-  call void @g(i8 %x4)
+  %x4 = load ptr, ptr @g4
+  call void @g(ptr %x4)
 
-  %x5 = load i8, ptr @g5
-  call void @g(i8 %x5)
+  %x5 = load ptr, ptr @g5
+  call void @g(ptr %x5)
   ret void
 }
 

@nikic
Copy link
Contributor Author

nikic commented Apr 30, 2025

Ping :)

Copy link
Contributor

@fhahn fhahn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but probably good to wait a day or so in case @ahatanak or @rjmccall have additional thoughts

@nikic nikic merged commit df26417 into llvm:main May 2, 2025
13 checks passed
@nikic nikic deleted the provenance-eval branch May 2, 2025 09:01
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
I believe this pass should only be calling PA.related() on pointer
arguments -- the operation is not really meaningful for non-pointers.

I've adjusted the test to use ptr loads instead of i8 loads, which I
believe aligns with how these special globals would actually be used,
and which is probably what this was intending to test.

Ran into this while trying to eliminate illegal non-pointer AA queries.
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
I believe this pass should only be calling PA.related() on pointer
arguments -- the operation is not really meaningful for non-pointers.

I've adjusted the test to use ptr loads instead of i8 loads, which I
believe aligns with how these special globals would actually be used,
and which is probably what this was intending to test.

Ran into this while trying to eliminate illegal non-pointer AA queries.
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
I believe this pass should only be calling PA.related() on pointer
arguments -- the operation is not really meaningful for non-pointers.

I've adjusted the test to use ptr loads instead of i8 loads, which I
believe aligns with how these special globals would actually be used,
and which is probably what this was intending to test.

Ran into this while trying to eliminate illegal non-pointer AA queries.
GeorgeARM pushed a commit to GeorgeARM/llvm-project that referenced this pull request May 7, 2025
I believe this pass should only be calling PA.related() on pointer
arguments -- the operation is not really meaningful for non-pointers.

I've adjusted the test to use ptr loads instead of i8 loads, which I
believe aligns with how these special globals would actually be used,
and which is probably what this was intending to test.

Ran into this while trying to eliminate illegal non-pointer AA queries.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants