[PATCH] D54199: [CodeGen] Fix bugs in BranchFolderPass when debug labels are generated.

Hsiangkai Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 28 19:16:42 PST 2018


HsiangKai marked an inline comment as done.
HsiangKai added inline comments.


================
Comment at: lib/CodeGen/BranchFolding.cpp:300
 ///  Whether MI should be counted as an instruction when calculating common tail.
 static bool countsAsInstruction(const MachineInstr &MI) {
+  return !(MI.isDebugInstr() || MI.isCFIInstruction());
----------------
HsiangKai wrote:
> aprantl wrote:
> > There is MachineInstr::isMetaInstruction(). Could you please remove this helper function and use that instead?
> It will change the semantics of BranchFoldingPass. In all other functions in this pass, it only considers debug instructions and CFI_INSTRUCTION. For example, the end of ComputeCommonTailLength() will skip debug instructions backward and skip CFI_INSTRUCTION forward. I need some time to think about what is the expected behavior of other meta instructions in BranchFoldingPass.
After applying !isMetaInstruction() to countsAsInstruction(), several test cases in LLVM will fail. It changed the structure of basic blocks in these failed cases. I think it is not trivial to apply isMetaInstruction() in BranchFoldingPass. Is it possible to accept the patch first and to consider isMetaInstruction() in another patch afterward?


Repository:
  rL LLVM

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

https://reviews.llvm.org/D54199





More information about the llvm-commits mailing list