[PATCH] D97665: [InstSimplify] Don't fold comparisons of non-inbounds GEPs
Juneyoung Lee via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 3 18:39:44 PST 2021
aqjune added a comment.
> I don't have a clear model for the semantics of pointer comparison ATM; Pointer comparison *sometimes* needs to take provenance into consideration because LLVM folds p1 == p2 where p1 and p2 are pointing to two different zero-size objects having the same address into false.
> Also, considering provenance into account allows aggressively folding pointer comparisons. It isn't clear how *frequently* the provenance should be considered.
FWIW, these are a few examples and relevant links:
- A ptr comparison folding to false regardless of addresses of two possibly overlapping stack allocations: https://godbolt.org/z/ok4vFJ , bugzilla report: https://bugs.llvm.org/show_bug.cgi?id=44342
- Another example: https://godbolt.org/z/bhrsK1 (well it wasn't a zero-size object, but simply merging two identical global objects. Anyway it shows that defining ptr comparison is something non-trivial), reduced from: https://bugs.llvm.org/show_bug.cgi?id=47090 , https://github.com/rust-lang/rust/issues/73722
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97665/new/
https://reviews.llvm.org/D97665
More information about the llvm-commits
mailing list