Skip to content

Commit

Permalink
[LegalizeDAG] Fix legalization of SETCC
Browse files Browse the repository at this point in the history
Summary:
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.

Reviewers: rogfer01, javed.absar, efriedma

Reviewed By: efriedma

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D43282

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325325 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
miyuki committed Feb 16, 2018
1 parent ca353f0 commit 053d9bf
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3766,7 +3766,7 @@ bool SelectionDAGLegalize::ExpandNode(SDNode *Node) {
// 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;
Expand Down
23 changes: 23 additions & 0 deletions test/CodeGen/ARM/2018-02-13-PR36079.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
; RUN: llc -mtriple=arm-eabi -mattr=+neon < %s -o - | FileCheck %s

@c = global [4 x i32] [i32 3, i32 3, i32 3, i32 3], align 4
@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
}

0 comments on commit 053d9bf

Please sign in to comment.