[PATCH] D19922: [AArch64] Fix DAG selection for cmps for fp16 type

Weiming Zhao via llvm-commits llvm-commits at lists.llvm.org
Tue May 10 18:07:53 PDT 2016


weimingz updated the summary for this revision.
weimingz removed rL LLVM as the repository for this revision.
weimingz updated this revision to Diff 56845.
weimingz added a comment.

This fixes the crash of "llc: tip/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:6340: void llvm::SelectionDAG::ReplaceAllUsesWith(llvm::SDNode *, llvm::SDNode *): Assertion `(!From->hasAnyUseOfValue(i) || From->getValueType(i) == To->getValueType(i)) && "Cannot use this version of ReplaceAllUsesWith!"' failed.


http://reviews.llvm.org/D19922

Files:
  lib/Target/AArch64/AArch64ISelLowering.cpp
  test/CodeGen/AArch64/half.ll

Index: test/CodeGen/AArch64/half.ll
===================================================================
--- test/CodeGen/AArch64/half.ll
+++ test/CodeGen/AArch64/half.ll
@@ -81,3 +81,15 @@
   store half %val16, half* %addr
   ret void
 }
+
+define i16 @test_fccmp(i1 %a) {
+;CHECK-LABEL: test_fccmp:
+;CHECK: fcmp
+  %cmp0 = fcmp ogt half 0xH3333, undef
+  %cmp1 = fcmp ogt half 0xH2222, undef
+  %x = select i1 %cmp0, i16 0, i16 undef
+  %or = or i1 %cmp1, %cmp0
+  %y = select i1 %or, i16 4, i16 undef
+  %r = add i16 %x, %y
+  ret i16 %r
+}
Index: lib/Target/AArch64/AArch64ISelLowering.cpp
===================================================================
--- lib/Target/AArch64/AArch64ISelLowering.cpp
+++ lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -1229,6 +1229,7 @@
     if (VT == MVT::f16) {
       LHS = DAG.getNode(ISD::FP_EXTEND, dl, MVT::f32, LHS);
       RHS = DAG.getNode(ISD::FP_EXTEND, dl, MVT::f32, RHS);
+      VT = MVT::f32;
     }
     return DAG.getNode(AArch64ISD::FCMP, dl, VT, LHS, RHS);
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19922.56845.patch
Type: text/x-patch
Size: 1022 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160511/4120cc5a/attachment.bin>


More information about the llvm-commits mailing list