[PATCH] D36645: [X86] When handling addcarry intrinsic, create the flag result with the correct type so we don't crash if we use a memory instruction
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 12 13:22:10 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL310784: [X86] When handling addcarry intrinsic, create the flag result with the correct… (authored by ctopper).
Changed prior to commit:
https://reviews.llvm.org/D36645?vs=110843&id=110854#toc
Repository:
rL LLVM
https://reviews.llvm.org/D36645
Files:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/test/CodeGen/X86/adx-intrinsics.ll
Index: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
@@ -20618,8 +20618,8 @@
}
// ADC/ADCX/SBB
case ADX: {
- SDVTList CFVTs = DAG.getVTList(Op->getValueType(0), MVT::Other);
- SDVTList VTs = DAG.getVTList(Op.getOperand(3)->getValueType(0), MVT::Other);
+ SDVTList CFVTs = DAG.getVTList(Op->getValueType(0), MVT::i32);
+ SDVTList VTs = DAG.getVTList(Op.getOperand(3)->getValueType(0), MVT::i32);
SDValue GenCF = DAG.getNode(X86ISD::ADD, dl, CFVTs, Op.getOperand(2),
DAG.getConstant(-1, dl, MVT::i8));
SDValue Res = DAG.getNode(IntrData->Opc0, dl, VTs, Op.getOperand(3),
Index: llvm/trunk/test/CodeGen/X86/adx-intrinsics.ll
===================================================================
--- llvm/trunk/test/CodeGen/X86/adx-intrinsics.ll
+++ llvm/trunk/test/CodeGen/X86/adx-intrinsics.ll
@@ -75,3 +75,30 @@
ret i8 %ret;
}
+; Try a version with loads. Previously we crashed on this.
+define i32 @load_crash(i64* nocapture readonly %a, i64* nocapture readonly %b, i64* %res) {
+; CHECK-LABEL: load_crash
+; CHECK: addb
+; ADX: adcxq
+; CHECK: setb
+; CHECK: retq
+ %1 = load i64, i64* %a, align 8
+ %2 = load i64, i64* %b, align 8
+ %3 = bitcast i64* %res to i8*
+ %4 = tail call i8 @llvm.x86.addcarryx.u64(i8 0, i64 %1, i64 %2, i8* %3)
+ %conv = zext i8 %4 to i32
+ ret i32 %conv
+}
+
+; Try a really simple all zero input case, which also used to crash
+define void @allzeros() {
+; CHECK-LABEL: allzeros
+; CHECK: xorl
+; CHECK: addb
+; CHECK: sbbq
+; CHECK: andl
+; CHECK: retq
+entry:
+ %0 = tail call i8 @llvm.x86.addcarryx.u64(i8 0, i64 0, i64 0, i8* null)
+ ret void
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36645.110854.patch
Type: text/x-patch
Size: 1825 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170812/55391110/attachment.bin>
More information about the llvm-commits
mailing list