[PATCH] D67785: Use getTargetConstant for BLENDI, and add a test to catch it.

Sterling Augustine via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 19 18:59:11 PDT 2019


saugustine created this revision.
saugustine added reviewers: echristo, arsenm.
Herald added subscribers: llvm-commits, hiraditya, nhaehnle, wdng, jvesely.
Herald added a project: LLVM.

This fixes a crasher introduced by r372338.


Repository:
  rL LLVM

https://reviews.llvm.org/D67785

Files:
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/test/CodeGen/AMDGPU/GlobalISel/isel-blendi-gettargetconstant.ll


Index: llvm/test/CodeGen/AMDGPU/GlobalISel/isel-blendi-gettargetconstant.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AMDGPU/GlobalISel/isel-blendi-gettargetconstant.ll
@@ -0,0 +1,66 @@
+; ModuleID = 'bugpoint-reduced-simplified.bc'
+source_filename = "complex_single-4eeacc.cpp"
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-grtev4-linux-gnu"
+
+define dso_local void @csrot_(float* %0) local_unnamed_addr #0 align 32 {
+  br i1 undef, label %20, label %2
+
+2:                                                ; preds = %1
+  %3 = load float, float* %0, align 4
+  br i1 undef, label %4, label %11
+
+4:                                                ; preds = %2
+  br i1 undef, label %5, label %16
+
+5:                                                ; preds = %4
+  br i1 undef, label %20, label %6
+
+6:                                                ; preds = %5
+  %7 = fsub float -0.000000e+00, %3
+  %8 = insertelement <2 x float> <float undef, float -0.000000e+00>, float %7, i32 0
+  br label %9
+
+9:                                                ; preds = %9, %6
+  store <2 x float> %8, <2 x float>* undef, align 8
+  br i1 undef, label %10, label %9
+
+10:                                               ; preds = %9
+  br label %20
+
+11:                                               ; preds = %2
+  br i1 undef, label %16, label %12
+
+12:                                               ; preds = %11
+  br i1 undef, label %20, label %13
+
+13:                                               ; preds = %12
+  br label %14
+
+14:                                               ; preds = %14, %13
+  br i1 undef, label %15, label %14
+
+15:                                               ; preds = %14
+  br label %20
+
+16:                                               ; preds = %11, %4
+  br i1 undef, label %20, label %17
+
+17:                                               ; preds = %16
+  br label %18
+
+18:                                               ; preds = %18, %17
+  br i1 undef, label %19, label %18
+
+19:                                               ; preds = %18
+  br label %20
+
+20:                                               ; preds = %19, %16, %15, %12, %10, %5, %1
+  ret void
+}
+
+attributes #0 = { "target-features"="+aes,+cx8,+fxsr,+mmx,+pclmul,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87" }
+
+!llvm.ident = !{!0}
+
+!0 = !{!"clang version google3-trunk (trunk r372353)"}
Index: llvm/lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- llvm/lib/Target/X86/X86ISelLowering.cpp
+++ llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -17632,7 +17632,7 @@
         // operand form.
         N1 = DAG.getNode(ISD::SCALAR_TO_VECTOR, dl, MVT::v4f32, N1);
         return DAG.getNode(X86ISD::BLENDI, dl, VT, N0, N1,
-                           DAG.getConstant(1, dl, MVT::i8));
+                           DAG.getTargetConstant(1, dl, MVT::i8));
       }
       // Create this as a scalar to vector..
       N1 = DAG.getNode(ISD::SCALAR_TO_VECTOR, dl, MVT::v4f32, N1);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67785.220932.patch
Type: text/x-patch
Size: 3199 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190920/89963914/attachment.bin>


More information about the llvm-commits mailing list