PR16490: fix a crash in ARMDAGToDAGISel::SelectInlineAsm.
authorJoey Gouly <joey.gouly@arm.com>
Fri, 5 Jul 2013 10:19:40 +0000 (10:19 +0000)
committerJoey Gouly <joey.gouly@arm.com>
Fri, 5 Jul 2013 10:19:40 +0000 (10:19 +0000)
In the SelectionDAG immediate operands to inline asm are constructed as
two separate operands. The first is a constant of value InlineAsm::Kind_Imm
and the second is a constant with the value of the immediate.

In ARMDAGToDAGISel::SelectInlineAsm, if we reach an operand of Kind_Imm we
should skip over the next operand too.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185688 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMISelDAGToDAG.cpp
test/CodeGen/ARM/arm-modifier.ll

index c85dcb4e79d718c6877aca285ddd11cf42893da5..da0fe2cf7d41b4a6a3ad7580771cca15c6e2deaf 100644 (file)
@@ -3491,6 +3491,12 @@ SDNode *ARMDAGToDAGISel::SelectInlineAsm(SDNode *N){
     else
       continue;
 
+    if (Kind == InlineAsm::Kind_Imm) {
+      SDValue op = N->getOperand(++i);
+      AsmNodeOperands.push_back(op);
+      continue;
+    }
+
     unsigned NumRegs = InlineAsm::getNumOperandRegisters(Flag);
     if (NumRegs)
       OpChanged.push_back(false);
index c74701663459ef19747a5cacdf5afa9062eb629d..e6358d481e9e4a563bdb382e7f926e9f03345134 100644 (file)
@@ -65,3 +65,8 @@ entry:
   %0 = tail call i64 asm sideeffect "ldrexd $0, ${0:H}, [$1]", "=&r,r,*Qo"(i64* %val, i64* %val) nounwind
   ret i64 %0
 }
+
+define void @f5(i64 %__pu_val) {
+  call void asm sideeffect "$1", "r,i"(i64 %__pu_val, i32 -14)
+  ret void
+}