Skip to content

Commit df26417

Browse files
authored
[ObjC][ProvenanceEval] Only evaluate pointers (#136876)
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.
1 parent aa10f87 commit df26417

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

llvm/lib/Transforms/ObjCARC/ProvenanceAnalysisEvaluator.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ static StringRef getName(Value *V) {
2727
static void insertIfNamed(SetVector<Value *> &Values, Value *V) {
2828
if (!V->hasName())
2929
return;
30+
if (!V->getType()->isPointerTy())
31+
return;
3032
Values.insert(V);
3133
}
3234

llvm/test/Transforms/ObjCARC/provenance.ll

+15-15
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,32 @@
77
@g4 = global i8 0, section "__TEXT,__objc_methname,cstring_literals"
88
@g5 = global i8 0, section "__TEXT,__cstring,cstring_literals"
99

10-
declare void @g(i8)
10+
declare void @g(ptr)
1111

1212
define void @f(ptr %a, ptr %b, ptr %c) {
13-
%y1 = load i8, ptr %a
14-
call void @g(i8 %y1)
13+
%y1 = load ptr, ptr %a
14+
call void @g(ptr %y1)
1515

1616
%y2 = load ptr, ptr %b
1717
%y3 = load ptr, ptr %c
1818

19-
%x0 = load i8, ptr @"\01l_objc_msgSend_fixup_"
20-
call void @g(i8 %x0)
19+
%x0 = load ptr, ptr @"\01l_objc_msgSend_fixup_"
20+
call void @g(ptr %x0)
2121

22-
%x1 = load i8, ptr @g1
23-
call void @g(i8 %x1)
22+
%x1 = load ptr, ptr @g1
23+
call void @g(ptr %x1)
2424

25-
%x2 = load i8, ptr @g2
26-
call void @g(i8 %x2)
25+
%x2 = load ptr, ptr @g2
26+
call void @g(ptr %x2)
2727

28-
%x3 = load i8, ptr @g3
29-
call void @g(i8 %x3)
28+
%x3 = load ptr, ptr @g3
29+
call void @g(ptr %x3)
3030

31-
%x4 = load i8, ptr @g4
32-
call void @g(i8 %x4)
31+
%x4 = load ptr, ptr @g4
32+
call void @g(ptr %x4)
3333

34-
%x5 = load i8, ptr @g5
35-
call void @g(i8 %x5)
34+
%x5 = load ptr, ptr @g5
35+
call void @g(ptr %x5)
3636
ret void
3737
}
3838

0 commit comments

Comments
 (0)