[PATCH] D43282: [LegalizeDAG] Fix legalization of SETCC

Mikhail Maltsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 14 03:22:21 PST 2018


miyuki created this revision.
miyuki added reviewers: rogfer01, javed.absar.

Currently when expanding a SETCC node into a SELECT_CC, LLVM uses
an incorrect type for determining BooleanContent of the result. This
patch fixes the issue.

Fixes PR36079.


https://reviews.llvm.org/D43282

Files:
  lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
  test/CodeGen/ARM/2018-02-13-PR36079.ll


Index: test/CodeGen/ARM/2018-02-13-PR36079.ll
===================================================================
--- /dev/null
+++ test/CodeGen/ARM/2018-02-13-PR36079.ll
@@ -0,0 +1,23 @@
+; RUN: llc -mtriple=arm-eabi -mattr=+neon < %s -o - | FileCheck %s
+
+ at c = global [4 x i32] [i32 3, i32 3, i32 3, i32 3], align 4
+ at d = common global i32 0, align 4
+
+define void @foo() local_unnamed_addr nounwind norecurse {
+entry:
+  %0 = load <4 x i32>, <4 x i32>* bitcast ([4 x i32]* @c to <4 x i32>*), align 4
+  %1 = and <4 x i32> %0,
+           <i32 1,
+            i32 zext (i1 icmp ne (i32* getelementptr inbounds ([4 x i32], [4 x i32]* @c, i32 0, i32 1), i32* @d) to i32),
+            i32 zext (i1 icmp ne (i32* getelementptr inbounds ([4 x i32], [4 x i32]* @c, i32 0, i32 2), i32* @d) to i32),
+            i32 zext (i1 icmp ne (i32* getelementptr inbounds ([4 x i32], [4 x i32]* @c, i32 0, i32 3), i32* @d) to i32)>
+  store <4 x i32> %1, <4 x i32>* bitcast ([4 x i32]* @c to <4 x i32>*), align 4
+  ret void
+; CHECK-NOT: mvnne
+; CHECK: movne r{{[0-9]+}}, #1
+; CHECK-NOT: mvnne
+; CHECK: movne r{{[0-9]+}}, #1
+; CHECK-NOT: mvnne
+; CHECK: movne r{{[0-9]+}}, #1
+; CHECK-NOT: mvnne
+}
Index: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -3766,7 +3766,7 @@
     // illegal; expand it into a SELECT_CC.
     EVT VT = Node->getValueType(0);
     int TrueValue;
-    switch (TLI.getBooleanContents(Tmp1->getValueType(0))) {
+    switch (TLI.getBooleanContents(Tmp1.getValueType())) {
     case TargetLowering::ZeroOrOneBooleanContent:
     case TargetLowering::UndefinedBooleanContent:
       TrueValue = 1;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43282.134188.patch
Type: text/x-patch
Size: 1769 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180214/dfcde4cd/attachment.bin>


More information about the llvm-commits mailing list