[PATCH] D144927: [GVNHoist] don't hoist callbr users into the callbr's block
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 9 01:10:14 PST 2023
nikic added inline comments.
================
Comment at: llvm/lib/Transforms/Scalar/GVNHoist.cpp:819
+ // the use above the def.
+ if (is_contained(T->users(), Insn))
+ continue;
----------------
nickdesaulniers wrote:
> hiraditya wrote:
> > hiraditya wrote:
> > > I'm assuming there are only a few `T->users` in practice, otherwise linear search on users could be slow.
> > maybe we can check if `Insn` has any operands that are defined by `T`
> > I'm assuming there are only a few T->users in practice
>
> In practice, only `CallBrInst`'s are terminators that produce values/can even have users. In practice, the number of users is 1.
>
> > maybe we can check if Insn has any operands that are defined by T
>
> Equivalent.
> In practice, only CallBrInst's are terminators that produce values/can even have users.
Invokes also produces values and have users. Though it's possible that those aren't supported by GVNHoist.
> In practice, the number of users is 1.
Hm, why? I'd expect more than one users even for front-end generated IR, depending on number of return values and number of control-flow paths.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144927/new/
https://reviews.llvm.org/D144927
More information about the llvm-commits
mailing list