[llvm] r331627 - [SystemZ] Bugfix for MVCLoop CC clobbering.

Jonas Paulsson via llvm-commits llvm-commits at lists.llvm.org
Mon May 7 03:48:43 PDT 2018


Author: jonpa
Date: Mon May  7 03:48:43 2018
New Revision: 331627

URL: http://llvm.org/viewvc/llvm-project?rev=331627&view=rev
Log:
[SystemZ]  Bugfix for MVCLoop CC clobbering.

MVCLoop clobbers CC (since it emits a compare/branch), but this was not
modelled.

Review: Ulrich Weigand

Added:
    llvm/trunk/test/CodeGen/SystemZ/cc-liveness.ll
Modified:
    llvm/trunk/lib/Target/SystemZ/SystemZInstrFormats.td

Modified: llvm/trunk/lib/Target/SystemZ/SystemZInstrFormats.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZInstrFormats.td?rev=331627&r1=331626&r2=331627&view=diff
==============================================================================
--- llvm/trunk/lib/Target/SystemZ/SystemZInstrFormats.td (original)
+++ llvm/trunk/lib/Target/SystemZ/SystemZInstrFormats.td Mon May  7 03:48:43 2018
@@ -4779,7 +4779,7 @@ class AtomicLoadWBinaryImm<SDPatternOper
 multiclass MemorySS<string mnemonic, bits<8> opcode,
                     SDPatternOperator sequence, SDPatternOperator loop> {
   def "" : SideEffectBinarySSa<mnemonic, opcode>;
-  let usesCustomInserter = 1, hasNoSchedulingInfo = 1 in {
+  let usesCustomInserter = 1, hasNoSchedulingInfo = 1, Defs = [CC] in {
     def Sequence : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src,
                                        imm64:$length),
                            [(sequence bdaddr12only:$dest, bdaddr12only:$src,

Added: llvm/trunk/test/CodeGen/SystemZ/cc-liveness.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/cc-liveness.ll?rev=331627&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/SystemZ/cc-liveness.ll (added)
+++ llvm/trunk/test/CodeGen/SystemZ/cc-liveness.ll Mon May  7 03:48:43 2018
@@ -0,0 +1,34 @@
+; Check that the MVCLoop (memcpy) is marked as clobbering CC, so that it will
+; not be placed betwen two compare and load-on-condition instructions.
+;
+; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 -pre-RA-sched=list-ilp \
+; RUN:   -print-after=expand-isel-pseudos 2>&1 | FileCheck %s
+;
+; CHECK-LABEL: bb.0.bb:
+; CHECK: CLI
+; CHECK: LOCGHI
+; CHECK-LABEL: bb.2.bb:
+; CHECK: MVC
+
+ at .str.35 = external dso_local unnamed_addr constant [9 x i8], align 2
+ at func_38.l_1854 = external dso_local unnamed_addr constant [7 x [10 x [3 x i64**]]], align 8
+
+; Function Attrs: nounwind
+define dso_local signext i32 @main(i32 signext %arg, i8** nocapture readonly %arg1) local_unnamed_addr #0 {
+bb:
+  %tmp = load i8, i8* undef, align 1
+  %tmp2 = zext i8 %tmp to i32
+  %tmp3 = sub nsw i32 0, %tmp2
+  %tmp4 = icmp eq i32 %tmp3, 0
+  %tmp5 = zext i1 %tmp4 to i32
+  call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 8 undef, i8* align 8 bitcast ([7 x [10 x [3 x i64**]]]* @func_38.l_1854 to i8*), i64 1680, i1 false) #2
+  call fastcc void @transparent_crc(i64 undef, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.35, i64 0, i64 0), i32 signext %tmp5)
+  unreachable
+}
+
+; Function Attrs: nounwind
+declare dso_local fastcc void @transparent_crc(i64, i8*, i32 signext) unnamed_addr #0
+
+; Function Attrs: argmemonly nounwind
+declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1) #1
+




More information about the llvm-commits mailing list