Closed RKSimon closed 7 years ago
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
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.
Per my previous comment, ninja check with expensive checks now fails now just twice in CodeGen/Generic.
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 think we should simply restrict thise two tests to x86.
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?
Per my previous comment, ninja check with expensive checks now fails now just twice in CodeGen/Generic.
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 think we should simply restrict thise two tests to x86.
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.
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)?
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:
Loop Pass Manager
Induction Variable Users
Loop Strength Reduction
Verify generated machine code <<< unexpected
MIR Printing Pass
?? This seems normal with expensive checks.
test/CodeGen/Generic/print-machineinstrs.ll:6:10: error: expected string not found in input ; CHECK: -branch-folder -machineinstr-printer ^
entry: tail call void @llvm.trap() ret i32 0
is lowered to
BB#0: derived from LLVM BB %entry
Trap
%vreg0
, 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?
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.
CodeGen/SystemZ/stack-guard.ll was fixed with r303743.
Still awaiting help on the Trap tests...
Adding people that might be able to help
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. // FIXME: This trap instruction should be marked as isTerminator, but there is // currently a general bug that allows non-terminators to be placed between // terminators. Temporarily leave this unmarked until the bug is fixed. let isTerminator=1, hasCtrlDep = 1, isBarrier = 1 in def Trap : Alias<4, (outs), (ins), [(trap)]>;
If I set this flag, I get:
IR Dump After Module Verifier define i32 @f0() { entry: tail call void @llvm.trap() ret i32 0 }
BB#0: derived from LLVM BB %entry
Trap
%vreg0
Bad machine code: Non-terminator instruction after the first terminator
Without it, the test fails like:
Function Live Ins: %R2D in %vreg0
BB#0: derived from LLVM BB %entry
Live Ins: %R2D
%vreg0
BB#1: derived from LLVM BB %if.then Predecessors according to CFG: BB#0 Trap
BB#2: derived from LLVM BB %if.end
Predecessors according to CFG: BB#0
%vreg2
Bad machine code: MBB exits via unconditional fall-through but ends with a barrier instruction!
Does anybody know more about this problem?
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