[llvm-commits] [llvm] r162998 - in /llvm/trunk: lib/CodeGen/SelectionDAG/InstrEmitter.cpp test/CodeGen/X86/inline-asm-tied.ll

Jakob Stoklund Olesen stoklund at 2pi.dk
Fri Aug 31 08:35:00 PDT 2012


Author: stoklund
Date: Fri Aug 31 10:34:59 2012
New Revision: 162998

URL: http://llvm.org/viewvc/llvm-project?rev=162998&view=rev
Log:
Don't enforce ordered inline asm operands.

I was too optimistic, inline asm can have tied operands that don't
follow the def order.

Fixes PR13742.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
    llvm/trunk/test/CodeGen/X86/inline-asm-tied.ll

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp?rev=162998&r1=162997&r2=162998&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp Fri Aug 31 10:34:59 2012
@@ -895,7 +895,6 @@
 
     // Remember to operand index of the group flags.
     SmallVector<unsigned, 8> GroupIdx;
-    unsigned PrevDefGroup = 0;
 
     // Add all of the operand registers to the instruction.
     for (unsigned i = InlineAsm::Op_FirstOperand; i != NumOps;) {
@@ -944,15 +943,6 @@
         if (InlineAsm::getKind(Flags) == InlineAsm::Kind_RegUse) {
           unsigned DefGroup = 0;
           if (InlineAsm::isUseOperandTiedToDef(Flags, DefGroup)) {
-            // Check that the def groups are monotonically increasing.
-            // Otherwise, the tied uses and defs won't line up, and
-            // MI::findTiedOperandIdx() will find the wrong operand. This
-            // should be automatically enforced by the front ends when
-            // translating "+" constraints into tied def+use pairs.
-            assert(DefGroup >= PrevDefGroup &&
-                   "Tied inline asm operands must be in increasing order.");
-            PrevDefGroup = DefGroup;
-
             unsigned DefIdx = GroupIdx[DefGroup] + 1;
             unsigned UseIdx = GroupIdx.back() + 1;
             for (unsigned j = 0; j != NumVals; ++j) {

Modified: llvm/trunk/test/CodeGen/X86/inline-asm-tied.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/inline-asm-tied.ll?rev=162998&r1=162997&r2=162998&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/inline-asm-tied.ll (original)
+++ llvm/trunk/test/CodeGen/X86/inline-asm-tied.ll Fri Aug 31 10:34:59 2012
@@ -19,3 +19,12 @@
 	%1 = load i64* %retval		; <i64> [#uses=1]
 	ret i64 %1
 }
+
+; The tied operands are not necessarily in the same order as the defs.
+; PR13742
+define i64 @swapped(i64 %x, i64 %y) nounwind {
+entry:
+	%x0 = call { i64, i64 } asm "foo", "=r,=r,1,0,~{dirflag},~{fpsr},~{flags}"(i64 %x, i64 %y) nounwind
+        %x1 = extractvalue { i64, i64 } %x0, 0
+        ret i64 %x1
+}





More information about the llvm-commits mailing list