This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen] Fix bugs in BranchFolderPass when debug labels are generated.
ClosedPublic

Authored by HsiangKai on Nov 6 2018, 11:54 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

HsiangKai created this revision.Nov 6 2018, 11:54 PM
aprantl added inline comments.Nov 7 2018, 8:10 AM
lib/CodeGen/BranchFolding.cpp
300

There is MachineInstr::isMetaInstruction(). Could you please remove this helper function and use that instead?

HsiangKai added inline comments.Nov 7 2018, 10:41 PM
lib/CodeGen/BranchFolding.cpp
300

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.

HsiangKai marked an inline comment as done.Nov 28 2018, 7:16 PM
HsiangKai added inline comments.
lib/CodeGen/BranchFolding.cpp
300

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?

aprantl accepted this revision.Nov 29 2018, 9:54 AM
This revision is now accepted and ready to land.Nov 29 2018, 9:54 AM
This revision was automatically updated to reflect the committed changes.