[PATCH] D107534: Add a pass to garbage-collect empty basic blocks after code generation.
Sriraman Tallam via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 15 15:23:43 PDT 2023
tmsriram added inline comments.
================
Comment at: llvm/lib/CodeGen/GCEmptyBasicBlocks.cpp:53
+ if (HasAnyRealCode)
+ continue;
+
----------------
If the block has no real instructions but debug instructions, is it correct to nuke it?
================
Comment at: llvm/lib/CodeGen/GCEmptyBasicBlocks.cpp:58
+ // predecessors. Although this shouldn't happen in valid code.
+ if (NextMBB == E && !Preds.empty())
+ continue;
----------------
If it is the last block it must have predecessors or you couldn't get to it, so !Preds.empty() is redundant.
================
Comment at: llvm/lib/CodeGen/GCEmptyBasicBlocks.cpp:70
+ if (JTI)
+ JTI->ReplaceMBBInJumpTables(&*MBB, &*NextMBB);
+ }
----------------
Should we add the non-real instructions in this block to the beginning of the next block too?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107534/new/
https://reviews.llvm.org/D107534
More information about the llvm-commits
mailing list