llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.25k stars 12.08k forks source link

IfConverter asserting on INLINEASM_BR MachineInstr #41357

Closed nickdesaulniers closed 2 years ago

nickdesaulniers commented 5 years ago
Bugzilla Link 42012
Resolution FIXED
Resolved on Sep 16, 2019 01:30
Version trunk
OS Linux
Blocks llvm/llvm-project#4440
CC @topperc,@efriedma-quic,@zmodem,@kbeyls,@smithp35,@stephenhines

Extended Description

forked from https://github.com/ClangBuiltLinux/linux/issues/494

See attached test case. We saw a few of these w/ x86_64. There's typically a pass that's removing a label that it should not be. I'll continue to dig, and report more info there.

nickdesaulniers commented 2 years ago

mentioned in issue llvm/llvm-project#9667

nickdesaulniers commented 2 years ago

mentioned in issue llvm/llvm-bugzilla-archive#42147

zmodem commented 5 years ago

Fixed: https://reviews.llvm.org/rL371434

And that was merged to release_90 in r371490.

nickdesaulniers commented 5 years ago

Fixed: https://reviews.llvm.org/rL371434

nickdesaulniers commented 5 years ago

Eli has a patch: https://reviews.llvm.org/D67306 I tested it and it solves the issue.

efriedma-quic commented 5 years ago

I've found the problem; I'll post a patch soon. Apparently, analyzeBranch on an INLINEASM_BR produces weird results, at least on some targets: it returns true to indicate failure, but TBB is non-null. This confuses IfConversion. Not sure if any other passes get confused by this.

efriedma-quic commented 5 years ago

Looks like ifconversion is misbehaving, again... looking.

nickdesaulniers commented 5 years ago

Creduce'd example: https://gist.github.com/nickdesaulniers/15b47087aa7bfca9d8df6208f4733231

Seems to be related to -fsanitize-coverage=trace-pc as well.

nickdesaulniers commented 5 years ago

Something strange is going on. I just tried to compile bttv-cards.o twice. The first crashed clang:

CC drivers/media/pci/bt8xx/bttv-cards.o fatal error: error in backend: Branch Fix Up pass failed to converge! clang-9: error: clang frontend command failed with exit code 70 (use -v to see invocation)

the second compiled. Nondeterminism?

Here's the test case (still trying to reduce it further): https://gist.github.com/nickdesaulniers/75346bd618121a3e98be648fb14ba03e (too big to be attached here). Running creduce now.

efriedma-quic commented 5 years ago

If the issue here isn't represented by the testcase in D62555, what is the issue, exactly? Can you put some sort of testcase here?

nickdesaulniers commented 5 years ago

Reopening; r371111 may have fixed the IR from D62555, but the larger issue is still a problem. I spoke too soon: https://github.com/ClangBuiltLinux/linux/issues/494#issuecomment-528952495

nickdesaulniers commented 5 years ago

confirming this is fixed in r371111, thanks again Eli!

efriedma-quic commented 5 years ago

r371111. (I haven't verified the C testcase, but the IR from D62555 is fixed.)

nickdesaulniers commented 5 years ago

patch: https://reviews.llvm.org/D62555

nickdesaulniers commented 5 years ago

assigned to @nickdesaulniers