[PATCH] D31539: Hoisting invariant.group in LICM
Piotr Padlewski via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 3 03:03:12 PDT 2017
Prazek added a comment.
> I thought your mailing list post was about //speculating// loads. Here we're not speculating anything -- we're only sinking. In any case, you do not need the `!invariant.group` metadata on the sunk load for the example above to "work".
The dereferenceable is usefull for speculative loads, but in tha last mail I showed the problem with other metadata:
If I will remove invariant.group md while hoisting from loop, then I probably won't be able to devirtualize it further. Consider:
void loop(A* a, int p) {
for (int i = 0; i < p; i++)
a->foo():
}
void call() {
A a;
clobber(&a); // external function
loop(&a, 15);
}
external void clobber(A *a);
if I will hoist vtable load of out the loop before inlining, then it won't be able to change it to A::foo(), because invariant.group will be removed.
If I will not hoist it, then it will be devirtualized after inlining, but for callsites of loop() that wasn't inlined it will be worse.
That means we need a way of specifing that one propery holds globally, which would mean that is not dependent on branch. for vtables and virtual function the invariant.group, invariant.load and !dereferenceable is a global property, and I can't loose this information.
https://reviews.llvm.org/D31539
More information about the llvm-commits
mailing list