[llvm] r302649 - [SystemZ] Implement getRepRegClassFor()

Jonas Paulsson via llvm-commits llvm-commits at lists.llvm.org
Wed May 10 06:03:26 PDT 2017


Author: jonpa
Date: Wed May 10 08:03:25 2017
New Revision: 302649

URL: http://llvm.org/viewvc/llvm-project?rev=302649&view=rev
Log:
[SystemZ]  Implement getRepRegClassFor()

This method must return a valid register class, or the list-ilp isel
scheduler will crash. For MVT::Untyped nullptr was previously returned, but
now ADDR128BitRegClass is returned instead. This is needed just as long as
list-ilp (and probably also list-hybrid) is still there.

Review: Ulrich Weigand, A Trick
https://reviews.llvm.org/D32802

Added:
    llvm/trunk/test/CodeGen/SystemZ/list-ilp-crash.ll
Modified:
    llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp
    llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.h

Modified: llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp?rev=302649&r1=302648&r2=302649&view=diff
==============================================================================
--- llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp Wed May 10 08:03:25 2017
@@ -6352,3 +6352,12 @@ MachineBasicBlock *SystemZTargetLowering
     llvm_unreachable("Unexpected instr type to insert");
   }
 }
+
+// This is only used by the isel schedulers, and is needed only to prevent
+// compiler from crashing when list-ilp is used.
+const TargetRegisterClass *
+SystemZTargetLowering::getRepRegClassFor(MVT VT) const {
+  if (VT == MVT::Untyped)
+    return &SystemZ::ADDR128BitRegClass;
+  return TargetLowering::getRepRegClassFor(VT);
+}

Modified: llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.h?rev=302649&r1=302648&r2=302649&view=diff
==============================================================================
--- llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.h (original)
+++ llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.h Wed May 10 08:03:25 2017
@@ -590,6 +590,8 @@ private:
   MachineBasicBlock *emitLoadAndTestCmp0(MachineInstr &MI,
                                          MachineBasicBlock *MBB,
                                          unsigned Opcode) const;
+
+  const TargetRegisterClass *getRepRegClassFor(MVT VT) const override;
 };
 } // end namespace llvm
 

Added: llvm/trunk/test/CodeGen/SystemZ/list-ilp-crash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/list-ilp-crash.ll?rev=302649&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/SystemZ/list-ilp-crash.ll (added)
+++ llvm/trunk/test/CodeGen/SystemZ/list-ilp-crash.ll Wed May 10 08:03:25 2017
@@ -0,0 +1,23 @@
+; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 -pre-RA-sched=list-ilp | FileCheck %s
+;
+; Check that list-ilp scheduler does not crash due to SystemZ's current use
+; of MVT::Untyped.
+
+define void @pr32723(i8) {
+; CHECK: .text
+BB:
+  br label %CF245
+
+CF245:                                            ; preds = %CF245, %BB
+  %Shuff57 = shufflevector <4 x i8> zeroinitializer, <4 x i8> zeroinitializer, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
+  %Cmp84 = icmp uge i8 %0, undef
+  br i1 %Cmp84, label %CF245, label %CF260
+
+CF260:                                            ; preds = %CF245
+  %B156 = sdiv <4 x i8> %Shuff57, %Shuff57
+  br label %CF255
+
+CF255:                                            ; preds = %CF255, %CF260
+  %I186 = insertelement <4 x i8> %B156, i8 %0, i32 2
+  br label %CF255
+}




More information about the llvm-commits mailing list