[PATCH] D32802: (Was: Add checks so that -pre-RA-sched=list-ilp does not crash on SystemZ (Bug 32723). ->) Implement getRepRegClassFor() in SystemZ.

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 10 00:33:40 PDT 2017


jonpa updated this revision to Diff 98409.
jonpa retitled this revision from "Add checks so that -pre-RA-sched=list-ilp does not crash on SystemZ (Bug 32723)." to "(Was: Add checks so that -pre-RA-sched=list-ilp does not crash on SystemZ (Bug 32723).  ->) Implement getRepRegClassFor() in SystemZ.".
jonpa added a comment.

At second thought, since the tests failed, it might be easier to do like Mips and just implement getRepRegClassFor() for MVT::Untyped, just so that the schedulers do not crash.

> As far as I am concerned I would happily remove this option. But as usual I don't know why it wasn't removed when the MachineScheduler was introduced and who/what targets may be depending on it...

Unfortunately, SystemZ is still using Sched::RegPressure, because the pre-ra mischeduler has so far not been used without regressions. This will hopefully be changed soon. It seems that other targets are still calling setSchedulingPreference() with the different schedulers, so this is then perhaps true also on other targets?


https://reviews.llvm.org/D32802

Files:
  lib/Target/SystemZ/SystemZISelLowering.cpp
  lib/Target/SystemZ/SystemZISelLowering.h
  test/CodeGen/SystemZ/list-ilp-crash.ll


Index: test/CodeGen/SystemZ/list-ilp-crash.ll
===================================================================
--- /dev/null
+++ test/CodeGen/SystemZ/list-ilp-crash.ll
@@ -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
+}
Index: lib/Target/SystemZ/SystemZISelLowering.h
===================================================================
--- lib/Target/SystemZ/SystemZISelLowering.h
+++ lib/Target/SystemZ/SystemZISelLowering.h
@@ -590,6 +590,8 @@
   MachineBasicBlock *emitLoadAndTestCmp0(MachineInstr &MI,
                                          MachineBasicBlock *MBB,
                                          unsigned Opcode) const;
+
+  const TargetRegisterClass *getRepRegClassFor(MVT VT) const override;
 };
 } // end namespace llvm
 
Index: lib/Target/SystemZ/SystemZISelLowering.cpp
===================================================================
--- lib/Target/SystemZ/SystemZISelLowering.cpp
+++ lib/Target/SystemZ/SystemZISelLowering.cpp
@@ -6353,3 +6353,12 @@
     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);
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32802.98409.patch
Type: text/x-patch
Size: 2167 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170510/b7b08c35/attachment.bin>


More information about the llvm-commits mailing list