[llvm] r294968 - [ARM] Fix crash caused by r294945

James Molloy via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 13 09:18:00 PST 2017


Author: jamesm
Date: Mon Feb 13 11:18:00 2017
New Revision: 294968

URL: http://llvm.org/viewvc/llvm-project?rev=294968&view=rev
Log:
[ARM] Fix crash caused by r294945

I'd missed a creator of FCMP nodes - duplicateCmp().

Kindly and promptly reported by Gabor Ballabas, due to his CSiBE test suite.

Added:
    llvm/trunk/test/CodeGen/ARM/vcmp-crash.ll
Modified:
    llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp

Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=294968&r1=294967&r2=294968&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Feb 13 11:18:00 2017
@@ -3812,10 +3812,12 @@ ARMTargetLowering::duplicateCmp(SDValue
   Cmp = Cmp.getOperand(0);
   Opc = Cmp.getOpcode();
   if (Opc == ARMISD::CMPFP)
-    Cmp = DAG.getNode(Opc, DL, MVT::Glue, Cmp.getOperand(0),Cmp.getOperand(1));
+    Cmp = DAG.getNode(Opc, DL, MVT::Glue, Cmp.getOperand(0),
+                      Cmp.getOperand(1), Cmp.getOperand(2));
   else {
     assert(Opc == ARMISD::CMPFPw0 && "unexpected operand of FMSTAT");
-    Cmp = DAG.getNode(Opc, DL, MVT::Glue, Cmp.getOperand(0));
+    Cmp = DAG.getNode(Opc, DL, MVT::Glue, Cmp.getOperand(0),
+                      Cmp.getOperand(1));
   }
   return DAG.getNode(ARMISD::FMSTAT, DL, MVT::Glue, Cmp);
 }

Added: llvm/trunk/test/CodeGen/ARM/vcmp-crash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/vcmp-crash.ll?rev=294968&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/vcmp-crash.ll (added)
+++ llvm/trunk/test/CodeGen/ARM/vcmp-crash.ll Mon Feb 13 11:18:00 2017
@@ -0,0 +1,11 @@
+; RUN: llc -mcpu=cortex-m4 < %s | FileCheck %s
+
+target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
+target triple = "thumbv7em-none--eabi"
+
+; CHECK: vcmp.f32
+define double @f(double %a, double %b, double %c, float %d) {
+  %1 = fcmp oeq float %d, 0.0
+  %2 = select i1 %1, double %a, double %c
+  ret double %2
+}




More information about the llvm-commits mailing list