[PATCH] D22103: [ARM] Skip inline asm memory operands in DAGToDAGISel
Diana Picus via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 20 02:55:51 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL276101: [ARM] Skip inline asm memory operands in DAGToDAGISel (authored by rovka).
Repository:
rL LLVM
https://reviews.llvm.org/D22103
Files:
llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp
llvm/trunk/test/CodeGen/ARM/inlineasm3.ll
Index: llvm/trunk/test/CodeGen/ARM/inlineasm3.ll
===================================================================
--- llvm/trunk/test/CodeGen/ARM/inlineasm3.ll
+++ llvm/trunk/test/CodeGen/ARM/inlineasm3.ll
@@ -121,3 +121,14 @@
%0 = tail call <4 x i32> asm "vld1.s32 {${0:e}[], ${0:f}[]}, [$1]", "=w,r"(i32* %p) nounwind
ret <4 x i32> %0
}
+
+; Bugzilla PR26038
+
+define i32 @fn1() local_unnamed_addr nounwind {
+; CHECK-LABEL: fn1
+entry:
+; CHECK: mov [[addr:r[0-9]+]], #5
+; CHECK: ldrh {{.*}}[[addr]]
+ %0 = tail call i32 asm "ldrh $0, $1", "=r,*Q"(i8* inttoptr (i32 5 to i8*)) nounwind
+ ret i32 %0
+}
Index: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp
===================================================================
--- llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp
+++ llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp
@@ -4264,6 +4264,17 @@
if (Changed && InlineAsm::isUseOperandTiedToDef(Flag, DefIdx))
IsTiedToChangedOp = OpChanged[DefIdx];
+ // Memory operands to inline asm in the SelectionDAG are modeled with two
+ // operands: a constant of value InlineAsm::Kind_Mem followed by the input
+ // operand. If we get here and we have a Kind_Mem, skip the next operand (so
+ // it doesn't get misinterpreted), and continue. We do this here because
+ // it's important to update the OpChanged array correctly before moving on.
+ if (Kind == InlineAsm::Kind_Mem) {
+ SDValue op = N->getOperand(++i);
+ AsmNodeOperands.push_back(op);
+ continue;
+ }
+
if (Kind != InlineAsm::Kind_RegUse && Kind != InlineAsm::Kind_RegDef
&& Kind != InlineAsm::Kind_RegDefEarlyClobber)
continue;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22103.64652.patch
Type: text/x-patch
Size: 1671 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160720/a2cc4e30/attachment.bin>
More information about the llvm-commits
mailing list