From e6e89875b04ea521a9dbf3e6a82d81b23f9f77d7 Mon Sep 17 00:00:00 2001 From: Kang Zhang Date: Tue, 26 May 2020 06:14:08 +0000 Subject: [PATCH] [NFC][PowerPC] Add a new case to test two-address verification --- .../CodeGen/PowerPC/two-address-crash.mir | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 llvm/test/CodeGen/PowerPC/two-address-crash.mir diff --git a/llvm/test/CodeGen/PowerPC/two-address-crash.mir b/llvm/test/CodeGen/PowerPC/two-address-crash.mir new file mode 100644 index 000000000000..6e98d3d8d398 --- /dev/null +++ b/llvm/test/CodeGen/PowerPC/two-address-crash.mir @@ -0,0 +1,45 @@ +# RUN: not --crash llc -mtriple=ppc32-- %s -run-pass=phi-node-elimination \ +# RUN: -verify-machineinstrs -o /dev/null 2>&1 | FileCheck %s + +--- | + define void @VerifyTwoAddressCrash(i16 %div.0.i.i.i.i, i32 %L_num.0.i.i.i.i, i32 %tmp1.i.i206.i.i, i16* %P) { + %X = shl i16 %div.0.i.i.i.i, 1 + %tmp28.i.i.i.i = shl i32 %L_num.0.i.i.i.i, 1 + %tmp31.i.i.i.i = icmp slt i32 %tmp28.i.i.i.i, %tmp1.i.i206.i.i + %tmp31.i.i.i.i.upgrd.1 = zext i1 %tmp31.i.i.i.i to i16 + %tmp371.i.i.i.i1 = or i16 %tmp31.i.i.i.i.upgrd.1, %X + %div.0.be.i.i.i.i = xor i16 %tmp371.i.i.i.i1, 1 + store i16 %div.0.be.i.i.i.i, i16* %P, align 2 + ret void + } + +... +--- +name: VerifyTwoAddressCrash +body: | + bb.0 (%ir-block.0): + liveins: $r3, $r4, $r5, $r6 + + %3:gprc_and_gprc_nor0 = COPY killed $r6 + %2:gprc = COPY killed $r5 + %1:gprc = COPY killed $r4 + %0:gprc = COPY killed $r3 + %4:gprc = RLWINM killed %1, 1, 0, 30 + %5:crrc = CMPW killed %4, killed %2 + %6:crbitrc = COPY killed %5.sub_lt + %7:gprc_and_gprc_nor0 = LI 0 + %8:gprc_and_gprc_nor0 = LI 1 + %9:gprc = ISEL killed %8, killed %7, killed %6 + %10:gprc = RLWIMI killed %9, killed %0, 1, 0, 30 + %11:gprc = XORI killed %10, 1 + STH killed %11, 0, killed %3 :: (store 2 into %ir.P) + BLR implicit $lr, implicit $rm + +... + +# CHECK-LABEL: Bad machine code: Two-address instruction operands must be identical +# CHECK-NEXT: - function: VerifyTwoAddressCrash +# CHECK-NEXT: - basic block: %bb.0 +# CHECK-NEXT: - instruction: %10:gprc = RLWIMI killed %9:gprc(tied-def 0), killed %3:gprc, 1, 0, 30 +# CHECK-NEXT: - operand 1: killed %9:gprc(tied-def 0) +# CHECK-NEXT: LLVM ERROR: Found 1 machine code errors.