[PATCH] D97848: [CodeGenPrepare] Eliminate llvm.expect before removing empty blocks
Jann Horn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 3 05:56:19 PST 2021
thejh added inline comments.
================
Comment at: llvm/lib/CodeGen/CodeGenPrepare.cpp:627-628
+ CurInstIterator = BB.begin();
+ while (CurInstIterator != BB.end()) {
+ Instruction *I = &*(CurInstIterator++);
+ if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(I)) {
----------------
bkramer wrote:
> We now have a `make_early_inc_range` thing to make this pattern less ugly. It can be used in a for range loop.
I don't think that fits well with `resetIteratorIfInvalidatedWhileCalling`? The code that I'm moving isn't just deleting the current instruction, but also other instructions that it depends on; my understanding is that the old code is explicitly resetting the iterator in case `RecursivelyDeleteTriviallyDeadInstructions` ends up throwing away the following instruction because it's recursing through a phi node, or something like that; and I'm preserving that behavior.
By the way, once you think this change is ready to land, please commit it for me - I don't have commit access.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97848/new/
https://reviews.llvm.org/D97848
More information about the llvm-commits
mailing list