llvm-project/llvm/test/MachineVerifier/test_phis_precede_nonphis.mir
Yuanfang Chen 4ad7685258 Revert "Revert "Reland "[Support] make report_fatal_error abort instead of exit"""
This reverts commit 80a34ae311 with fixes.

Previously, since bots turning on EXPENSIVE_CHECKS are essentially turning on
MachineVerifierPass by default on X86 and the fact that
inline-asm-avx-v-constraint-32bit.ll and inline-asm-avx512vl-v-constraint-32bit.ll
are not expected to generate functioning machine code, this would go
down to `report_fatal_error` in MachineVerifierPass. Here passing
`-verify-machineinstrs=0` to make the intent explicit.
2020-02-13 10:16:06 -08:00

85 lines
2.0 KiB
YAML

# RUN: not --crash llc -run-pass=machineverifier %s -o - 2>&1 | FileCheck %s
# REQUIRES: aarch64-registered-target
--- |
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
target triple = "aarch64--"
define void @valid(i8* %addr) {
entry:
br i1 0, label %if, label %else
if:
br label %exit
else:
br label %exit
exit:
ret void
}
define void @broken(i8* %addr) {
entry:
br i1 0, label %if, label %exit
if:
br label %exit
exit:
ret void
}
...
---
name: valid
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $w1
successors: %bb.1(0x40000000), %bb.2(0x40000000); %bb.1(50.00%), %bb.2(50.00%)
%1:_(s32) = COPY $w1
%2:_(s32) = G_CONSTANT i32 1
%3:_(s1) = G_ICMP intpred(ne), %1:_(s32), %2:_
G_BRCOND %3:_(s1), %bb.1
G_BR %bb.2.else
bb.1.if:
successors: %bb.3(0x80000000)
%4:_(s32) = G_CONSTANT i32 1
%5:_(s8) = G_TRUNC %4
G_BR %bb.3.exit
bb.2.else:
successors: %bb.3(0x80000000)
%6:_(s32) = G_CONSTANT i32 1
%7:_(s8) = G_TRUNC %6
G_BR %bb.3.exit
bb.3.exit:
%8:_(s8) = G_PHI %5:_(s8), %bb.1, %7:_(s8), %bb.2
%9:_(s32) = G_ZEXT %8
$w1 = COPY %9
...
---
name: broken
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $w1
successors: %bb.1(0x40000000), %bb.2(0x40000000); %bb.1(50.00%), %bb.2(50.00%)
%1:_(s32) = COPY $w1
%2:_(s32) = G_CONSTANT i32 1
%3:_(s1) = G_ICMP intpred(ne), %1:_(s32), %2:_
%4:_(s32) = G_CONSTANT i32 1
%6:_(s8) = G_CONSTANT i8 2
G_BRCOND %3:_(s1), %bb.1
G_BR %bb.2.exit
bb.1.if:
successors: %bb.2(0x80000000)
G_BR %bb.2.exit
bb.2.exit:
%5:_(s8) = G_TRUNC %4
%8:_(s8) = G_PHI %5:_(s8), %bb.0, %6:_(s8), %bb.1
%9:_(s32) = G_ZEXT %8
$w1 = COPY %9
...
# CHECK-NOT: Bad machine code
# CHECK-LABEL: Bad machine code: Found PHI instruction after non-PHI
# CHECK-NEXT: - function: broken
# CHECK-NEXT: - basic block: %bb.2 exit
# CHECK-NEXT: - instruction: %6:_(s8) = G_PHI %5:_(s8), %bb.0, %4:_(s8), %bb.1
# CHECK-NOT: Bad machine code