[llvm] r321595 - [X86] Fix a crash when returning a <1 x i1> value>
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 30 23:38:30 PST 2017
Author: ctopper
Date: Sat Dec 30 23:38:30 2017
New Revision: 321595
URL: http://llvm.org/viewvc/llvm-project?rev=321595&view=rev
Log:
[X86] Fix a crash when returning a <1 x i1> value>
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/test/CodeGen/X86/avx512-calling-conv.ll
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=321595&r1=321594&r2=321595&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sat Dec 30 23:38:30 2017
@@ -2143,6 +2143,10 @@ static SDValue lowerMasksToReg(const SDV
const SDLoc &Dl, SelectionDAG &DAG) {
EVT ValVT = ValArg.getValueType();
+ if (ValVT == MVT::v1i1)
+ return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, Dl, ValLoc, ValArg,
+ DAG.getIntPtrConstant(0, Dl));
+
if ((ValVT == MVT::v8i1 && (ValLoc == MVT::i8 || ValLoc == MVT::i32)) ||
(ValVT == MVT::v16i1 && (ValLoc == MVT::i16 || ValLoc == MVT::i32))) {
// Two stage lowering might be required
Modified: llvm/trunk/test/CodeGen/X86/avx512-calling-conv.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/avx512-calling-conv.ll?rev=321595&r1=321594&r2=321595&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/avx512-calling-conv.ll (original)
+++ llvm/trunk/test/CodeGen/X86/avx512-calling-conv.ll Sat Dec 30 23:38:30 2017
@@ -410,3 +410,22 @@ define i32 @test12(i32 %a1, i32 %a2, i32
%res1 = select i1 %cond, i32 %res, i32 0
ret i32 %res1
}
+
+define <1 x i1> @test13(<1 x i1>* %foo) {
+; ALL_X64-LABEL: test13:
+; ALL_X64: ## %bb.0:
+; ALL_X64-NEXT: movzbl (%rdi), %eax
+; ALL_X64-NEXT: andl $1, %eax
+; ALL_X64-NEXT: ## kill: def %al killed %al killed %eax
+; ALL_X64-NEXT: retq
+;
+; KNL_X32-LABEL: test13:
+; KNL_X32: ## %bb.0:
+; KNL_X32-NEXT: movl {{[0-9]+}}(%esp), %eax
+; KNL_X32-NEXT: movzbl (%eax), %eax
+; KNL_X32-NEXT: andl $1, %eax
+; KNL_X32-NEXT: ## kill: def %al killed %al killed %eax
+; KNL_X32-NEXT: retl
+ %bar = load <1 x i1>, <1 x i1>* %foo
+ ret <1 x i1> %bar
+}
More information about the llvm-commits
mailing list