You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[GlobalOpt] Check if global gets compared to pointer of different obj.
Add an extra check to the compare handling to make sure the other
compared pointer cannot be based on a different object.
For example, consider the IR below, which may write @b via a pointer constructed
from @A using PtrToInt and a compare against @b.
```
%cmp = icmp eq ptr inttoptr (i64 add (i64 ptrtoint (ptr @A to i64), i64 8) to ptr) , @b
br i1 %cmp, label %then, label %else
then:
store i64 10, ptr inttoptr (i64 add (i64 ptrtoint (ptr @A to i64), i64 8) to ptr)
br label %exit
else:
br label %exit
exit:
%l = load i64, ptr @b
ret i64 %l
}
```
0 commit comments