New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SystemZ check has a bunch of machine verifier errors #32394
Comments
The trap problem seems to relate to an issue that keeps the SystemZ backend to use the isTerminator flag on the SystemZ::Trap instruction, per the comment in SystemZInstrInfo.td: // Unconditional trap. If I set this flag, I get: *** IR Dump After Module Verifier *** After Instruction SelectionMachine code for function f0: IsSSA, TracksLivenessBB#0: derived from LLVM BB %entry End machine code for function f0.*** Bad machine code: Non-terminator instruction after the first terminator ***
Without it, the test fails like: After Instruction SelectionMachine code for function f1: IsSSA, TracksLivenessFunction Live Ins: %R2D in %vreg0 BB#0: derived from LLVM BB %entry BB#1: derived from LLVM BB %if.then BB#2: derived from LLVM BB %if.end End machine code for function f1.*** Bad machine code: MBB exits via unconditional fall-through but ends with a barrier instruction! ***
Does anybody know more about this problem? |
Adding people that might be able to help |
CodeGen/SystemZ/stack-guard.ll was fixed with r303743. Still awaiting help on the Trap tests... |
r304320 enabled the machine verifier by default with EXPENSIVE_CHECKS. SystemZ is one of the targets excluded from this by overriding TargetMachine::isMachineVerifierClean() to return false. Please remove the override when the target at least passes all lit tests without machine verifier failure. |
entry: is lowered to BB#0: derived from LLVM BB %entry , which is incorrect since the Trap instruction is a terminator. This could be fixed in SystemZTargetLowering::LowerReturn(), so that the Trap is scheduled per its terminator flag. It seems however that the return shouldn't be there in the first place, since it is unreachable. Could it be that a return (or any other instruction) after a llvm.trap() call should be removed as dead code even before isel? |
The trap problem seems to be resolved by simply removing barrier and terminator flags on the trap instructions. What's left now before SystemZ is clean are two (new) fails in CodeGen/Generic, which I am a bit puzzled with: test/CodeGen/Generic/llc-start-stop.ll:5:20: error: STOP-AFTER-NEXT: is not on the line after the previous match llc generates:
?? This seems normal with expensive checks. test/CodeGen/Generic/print-machineinstrs.ll:6:10: error: expected string not found in input Note that both -branch-folder and -machineinstr-printer are part of that long list. How could these two test cases fail on SystemZ but not on other targets? |
Per my previous comment, ninja check with expensive checks now fails now just twice in CodeGen/Generic. Is the intent that the target should return true (stop overriding) in isMachineVerifierClean() when the target codegen tests passes (check-llvm-codegen-systemz)? |
Great! I think those tests in generic are not generic enough. Sure they test generic facilities like --start-after etc. but the actual output can obviously differ depending on how the target sets up their pass pipeline. |
I would expect those tests to fail also for X86 whith expensive checks, since they simply fail when the verifier is all of a sudden present in the argument / pass list. Is it possible to disable these tests when EXPENSIVE_CHECKS is defined? Otherwise, one idea is to use -verify-machineinstrs on those tests so that it is possible to always expect the verifier there. If you think this is ok, could I go ahead and commit, or should I open a review? |
This makes sense to me, especially if it means it can stay Generic and be tested on all targets. Go ahead and commit if you have tested on all targets. |
OK, take a look: r306106 |
Extended Description
Enabling machine code verification with EXPENSIVE_CHECKS (https://reviews.llvm.org/D30625) causes a number of machine verifier errors with
ninja check-codegen-systemz
:Failing Tests (6):
LLVM :: CodeGen/SystemZ/stack-guard.ll
LLVM :: CodeGen/SystemZ/trap-01.ll
LLVM :: CodeGen/SystemZ/trap-02.ll
LLVM :: CodeGen/SystemZ/trap-03.ll
LLVM :: CodeGen/SystemZ/trap-04.ll
LLVM :: CodeGen/SystemZ/trap-05.ll
The text was updated successfully, but these errors were encountered: