[PATCH] D92608: [JumpThreading] Call eraseBlock when folding a conditional branch

Kazu Hirata via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 3 21:56:29 PST 2020


kazu marked 2 inline comments as done.
kazu added a comment.

Thanks for the review!



================
Comment at: llvm/lib/Transforms/Scalar/JumpThreading.cpp:1097
                       << "' folding undef terminator: " << *BBTerm << '\n');
     BranchInst::Create(BBTerm->getSuccessor(BestSucc), BBTerm);
     BBTerm->eraseFromParent();
----------------
yrouban wrote:
> should not we BPI->eraseBlock(BB) here? another patch?
Thank you for spotting.  Yes, I'll take care of this in another patch.


================
Comment at: llvm/lib/Transforms/Scalar/JumpThreading.cpp:1114
     ConstantFoldTerminator(BB, true, nullptr, DTU);
+    if (HasProfileData)
+      BPI->eraseBlock(BB);
----------------
yrouban wrote:
> can we add an assertion on the return value of the ConstantFoldTerminator() call?
Good point.  Let me address this in another patch after testing.  Also, I'd like to make it easier to revert the assertion patch just in case.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92608/new/

https://reviews.llvm.org/D92608



More information about the llvm-commits mailing list