[PATCH] D71093: [InstCombine] Insert instructions before adding them to worklist
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 14 01:33:42 PST 2019
nikic added inline comments.
================
Comment at: llvm/include/llvm/Transforms/InstCombine/InstCombineWorklist.h:95-96
+ auto *UI = cast<Instruction>(U);
+ // Do not add instructions that haven't been properly inserted yet.
+ if (UI->getParent()) {
+ Add(UI);
----------------
kuhar wrote:
> lebedev.ri wrote:
> > The described behavior sounds like a bug to me.
> > More importantly, it's not related to the printing changes?
> The users that I refer to here are new instructions that are being constructed; InstCombine inserts them in subsequent calls to `Add()`. This happens in a few places and it's not obvious to me make it more straight-forward.
> With the changes to the worklist here, everything works like before and the order of iteration is exactly the same.
>
> Let me know if you want me to dig up some concrete examples for this behavior here.
I'd appreciate an example for this. I can see how it can happen in principle, but not really why we'd write the code that way in practice.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71093/new/
https://reviews.llvm.org/D71093
More information about the llvm-commits
mailing list