llvm.org GIT mirror llvm / a550fda
[SystemZ] Fix trap issue and enable expensive checks. The isBarrier/isTerminator flags have been removed from the SystemZ trap instructions, so that tests do not fail with EXPENSIVE_CHECKS. This was just an issue at -O0 and did not affect code output on benchmarks. (Like Eli pointed out: "targets are split over whether they consider their "trap" a terminator; x86, AArch64, and NVPTX don't, but ARM, MIPS, PPC, and SystemZ do. We should probably try to be consistent here.". This is still the case, although SystemZ has switched sides). SystemZ now returns true in isMachineVerifierClean() :-) These Generic tests have been modified so that they can be run with or without EXPENSIVE_CHECKS: CodeGen/Generic/llc-start-stop.ll and CodeGen/Generic/print-machineinstrs.ll Review: Ulrich Weigand, Simon Pilgrim, Eli Friedman https://bugs.llvm.org/show_bug.cgi?id=33047 https://reviews.llvm.org/D34143 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306106 91177308-0d34-0410-b5e6-96231b3b80d8 Jonas Paulsson 3 years ago
5 changed file(s) with 29 addition(s) and 18 deletion(s). Raw diff Collapse all Expand all
188188 //===----------------------------------------------------------------------===//
189189
190190 // Unconditional trap.
191 // FIXME: This trap instruction should be marked as isTerminator, but there is
192 // currently a general bug that allows non-terminators to be placed between
193 // terminators. Temporarily leave this unmarked until the bug is fixed.
194 let isBarrier = 1, hasCtrlDep = 1 in
191 let hasCtrlDep = 1 in
195192 def Trap : Alias<4, (outs), (ins), [(trap)]>;
196193
197194 // Conditional trap.
198 let isTerminator = 1, hasCtrlDep = 1, Uses = [CC] in
195 let hasCtrlDep = 1, Uses = [CC] in
199196 def CondTrap : Alias<4, (outs), (ins cond4:$valid, cond4:$R1), []>;
200197
201198 // Fused compare-and-trap instructions.
202 let isTerminator = 1, hasCtrlDep = 1 in {
199 let hasCtrlDep = 1 in {
203200 // These patterns work the same way as for compare-and-branch.
204201 defm CRT : CmpBranchRRFcPair<"crt", 0xB972, GR32>;
205202 defm CGRT : CmpBranchRRFcPair<"cgrt", 0xB960, GR64>;
5050 }
5151
5252 bool targetSchedulesPostRAScheduling() const override { return true; };
53
54 bool isMachineVerifierClean() const override { return false; }
5553 };
5654
5755 } // end namespace llvm
None ; RUN: llc < %s -debug-pass=Structure -stop-after=loop-reduce -o /dev/null 2>&1 | FileCheck %s -check-prefix=STOP-AFTER
0 ; Note: -verify-machineinstrs is used in order to make this test compatible with EXPENSIVE_CHECKS.
1 ; RUN: llc < %s -debug-pass=Structure -stop-after=loop-reduce -verify-machineinstrs -o /dev/null 2>&1 \
2 ; RUN: | FileCheck %s -check-prefix=STOP-AFTER
13 ; STOP-AFTER: -loop-reduce
24 ; STOP-AFTER: Dominator Tree Construction
35 ; STOP-AFTER: Loop Strength Reduction
6 ; STOP-AFTER-NEXT: Verify generated machine code
47 ; STOP-AFTER-NEXT: MIR Printing Pass
58
69 ; RUN: llc < %s -debug-pass=Structure -stop-before=loop-reduce -o /dev/null 2>&1 | FileCheck %s -check-prefix=STOP-BEFORE
None ; RUN: llc < %s -O3 -debug-pass=Structure -print-machineinstrs=branch-folder -o /dev/null 2>&1 | FileCheck %s
1 ; RUN: llc < %s -O3 -debug-pass=Structure -print-machineinstrs -o /dev/null 2>&1 | FileCheck %s
2 ; RUN: llc < %s -O3 -debug-pass=Structure -print-machineinstrs= -o /dev/null 2>&1 | FileCheck %s
0 ; RUN: llc < %s -O3 -debug-pass=Structure -print-machineinstrs=branch-folder -verify-machineinstrs -o /dev/null 2>&1 \
1 ; RUN: | FileCheck %s -check-prefix=PRINT-BRANCH-FOLD
2 ; RUN: llc < %s -O3 -debug-pass=Structure -print-machineinstrs -verify-machineinstrs -o /dev/null 2>&1 \
3 ; RUN: | FileCheck %s -check-prefix=PRINT
4 ; RUN: llc < %s -O3 -debug-pass=Structure -print-machineinstrs= -verify-machineinstrs -o /dev/null 2>&1 \
5 ; RUN: | FileCheck %s -check-prefix=PRINT
6
7 ; Note: -verify-machineinstrs is used in order to make this test compatible with EXPENSIVE_CHECKS.
38
49 define i64 @foo(i64 %a, i64 %b) nounwind {
5 ; CHECK: -branch-folder -machineinstr-printer
6 ; CHECK: Control Flow Optimizer
7 ; CHECK-NEXT: MachineFunction Printer
8 ; CHECK: Machine code for function foo:
10 ; PRINT-BRANCH-FOLD: -branch-folder -machineverifier -machineinstr-printer
11 ; PRINT-BRANCH-FOLD: Control Flow Optimizer
12 ; PRINT-BRANCH-FOLD-NEXT: Verify generated machine code
13 ; PRINT-BRANCH-FOLD-NEXT: MachineFunction Printer
14 ; PRINT-BRANCH-FOLD: Machine code for function foo:
15
16 ; PRINT: -branch-folder -machineinstr-printer
17 ; PRINT: Control Flow Optimizer
18 ; PRINT-NEXT: MachineFunction Printer
19 ; PRINT-NEXT: Verify generated machine code
20 ; PRINT: Machine code for function foo:
21
922 %c = add i64 %a, %b
1023 %d = trunc i64 %c to i32
1124 %e = zext i32 %d to i64
4646 define i32 @f3(i32 zeroext %a, i32 *%base, i64 %offset) {
4747 ; CHECK-LABEL: f3:
4848 ; CHECK: cl %r2, 0(%r{{[0-5]}},%r3)
49 ; CHECK: lhi %r2, 0
4950 ; CHECK-LABEL: .Ltmp0
5051 ; CHECK: jh .Ltmp0+2
51 ; CHECK: lhi %r2, 0
5252 ; CHECK: br %r14
5353 entry:
5454 %ptr = getelementptr i32, i32 *%base, i64 %offset
6969 define i64 @f4(i64 %a, i64 *%base, i64 %offset) {
7070 ; CHECK-LABEL: f4:
7171 ; CHECK: clg %r2, 0(%r{{[0-5]}},%r3)
72 ; CHECK: lghi %r2, 0
7273 ; CHECK-LABEL: .Ltmp1
7374 ; CHECK: jh .Ltmp1+2
74 ; CHECK: lghi %r2, 0
7575 ; CHECK: br %r14
7676 entry:
7777 %ptr = getelementptr i64, i64 *%base, i64 %offset