[PATCH] D109548: Make llvm.launder.invariant.group writeonly
Piotr Padlewski via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 10 05:10:21 PDT 2021
Prazek requested changes to this revision.
Prazek added a comment.
This revision now requires changes to proceed.
Actually, as Krzysztof Pszeniczny pointed out offline, I think we can't mark it as writeonly, because it would let optimizer to optimize:
%a = launder(%0)
%b = launder(%0)
As it could assume that both launders store the same value. This could bite us in cases like (https://godbolt.org/z/YaGrrWosj):
void foo(A *a) {
auto *b = new(a)B;
use(b);
auto *c = new(a)A;
}
Here we will have both launders use the same pointer argument (`a`), so call like `c->foo()` could be optimzied to `b->foo()` if two launders would be merged.
However, for somre reason LLVM does not do that if I mark the launder as writeonly - probably a missed optimization? (but perhaps not that important).
Does is make sense, or am I misuderstanding the writeonly?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D109548/new/
https://reviews.llvm.org/D109548
More information about the llvm-commits
mailing list