This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG] remove stale check assuming INLINEASM_BR is terminator
AbandonedPublic

Authored by nickdesaulniers on Oct 27 2022, 11:42 AM.

Details

Summary

D79794 changed INLINEASM_BR from being a termintor to not.

While reading though SelectionDAGBuilder::visitInlineAsm, I noticed a
comment regarding INLINEASM_BR being a terminator, which seemed stale.

Removing the code that has an assumption does change the placement of a
TokenFactor in one test, but does not change the final output. The
assembler generated is ultimately the same.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptOct 27 2022, 11:42 AM
nickdesaulniers requested review of this revision.Oct 27 2022, 11:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 27 2022, 11:42 AM
arsenm accepted this revision.Oct 27 2022, 11:45 AM
This revision is now accepted and ready to land.Oct 27 2022, 11:45 AM

See also:

commit 97d4f7c19414 ("[SelectionDAGBuilder] Flush PendingExports before creating INLINEASM_BR node for asm goto.")

D59981

Also, commit e97e52757cfb ("[X86] Add test case for r361177.")

https://reviews.llvm.org/rGe97e52757cfb

void added a comment.Oct 27 2022, 12:20 PM

For the love of God, that test output is unreadable...

This LGTM, but @craig.topper should check to make sure.

craig.topper added inline comments.Oct 27 2022, 12:27 PM
llvm/test/CodeGen/X86/callbr-asm-bb-exports.ll
22

This means the copies to virtual register %0 and %1 are no longer guaranteed to happen before the inlineasm_br block is executed. Since I think one of those is used by the fail basic block, that seems wrong.

@craig.topper mentions on discord:

A TokenFactor collects multiple chains into a single chain. Chains are used to maintain order of things that don't have a natural data dependency.
Previously the inlineasm_br chain was dependent on the copy chains so it had to occur after them. Now they are considered independent.

Perhaps then the best way forward here is to simply adapt the existing comment that is still stale? Somehow?

nickdesaulniers planned changes to this revision.Oct 27 2022, 12:45 PM
nickdesaulniers abandoned this revision.Dec 7 2022, 11:24 AM