[llvm] r245530 - [PowerPC] Fix the int2fp(fp2int(x)) DAGCombine to ignore ppc_fp128

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 19 18:18:20 PDT 2015


Author: hfinkel
Date: Wed Aug 19 20:18:20 2015
New Revision: 245530

URL: http://llvm.org/viewvc/llvm-project?rev=245530&view=rev
Log:
[PowerPC] Fix the int2fp(fp2int(x)) DAGCombine to ignore ppc_fp128

This DAGCombine was creating custom SDAG nodes with an illegal ppc_fp128
operand type because it was triggering on f64/f32 int2fp(fp2int(ppc_fp128 x)),
but shouldn't (it should only apply to f32/f64 types). The result was a crash.

Added:
    llvm/trunk/test/CodeGen/PowerPC/fp2int2fp-ppcfp128.ll
Modified:
    llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp

Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=245530&r1=245529&r2=245530&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Wed Aug 19 20:18:20 2015
@@ -9991,6 +9991,9 @@ SDValue PPCTargetLowering::combineFPToIn
     if (Src.getValueType() == MVT::f32) {
       Src = DAG.getNode(ISD::FP_EXTEND, dl, MVT::f64, Src);
       DCI.AddToWorklist(Src.getNode());
+    } else if (Src.getValueType() != MVT::f64) {
+      // Make sure that we don't pick up a ppc_fp128 source value.
+      return SDValue();
     }
 
     unsigned FCTOp =

Added: llvm/trunk/test/CodeGen/PowerPC/fp2int2fp-ppcfp128.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/fp2int2fp-ppcfp128.ll?rev=245530&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/fp2int2fp-ppcfp128.ll (added)
+++ llvm/trunk/test/CodeGen/PowerPC/fp2int2fp-ppcfp128.ll Wed Aug 19 20:18:20 2015
@@ -0,0 +1,16 @@
+; RUN: llc -mcpu=a2 < %s | FileCheck %s
+target datalayout = "E-m:e-i64:64-n32:64"
+target triple = "powerpc64-bgq-linux"
+
+define linkonce_odr double @test1() {
+entry:
+  %conv6.i.i = fptosi ppc_fp128 undef to i64
+  %conv.i = sitofp i64 %conv6.i.i to double
+  ret double %conv.i
+
+; CHECK-LABEL: @test1
+; CHECK: bl __fixtfdi
+; CHECK: fcfid
+; CHECK: blr
+}
+




More information about the llvm-commits mailing list