This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel] Ensure that translateInvoke adds all successors for inlineasm
ClosedPublic

Authored by paquette on Nov 8 2021, 2:50 PM.

Details

Summary

The existing code didn't add all necessary successors, which resulted in disjoint basic blocks. These would end up not being legalized which, in the best case, caused a fallback only in assert builds.

Here's an example:

https://godbolt.org/z/ndx15Enfj

We also end up getting weird codegen here as well.

Refactoring the code here allows us to correctly attach all successors. With this patch, the above example gives correct codegen at -O0 with and without asserts.

Also autogen the testcase to show that we add all the successors now.

Diff Detail

Event Timeline

paquette created this revision.Nov 8 2021, 2:50 PM
paquette requested review of this revision.Nov 8 2021, 2:50 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 8 2021, 2:50 PM
Herald added a subscriber: wdng. · View Herald Transcript
arsenm accepted this revision.Nov 9 2021, 12:51 PM
arsenm added inline comments.
llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-unwind-inline-asm.ll
51

Is there a test missing for the !canThrow case?

This revision is now accepted and ready to land.Nov 9 2021, 12:51 PM
paquette added inline comments.Nov 9 2021, 4:03 PM
llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-unwind-inline-asm.ll
51

llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-no-unwind-inline-asm.ll should test that path.