aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPawel Wodnicki <pawel@32bitmicro.com>2012-11-23 20:02:28 +0000
committerPawel Wodnicki <pawel@32bitmicro.com>2012-11-23 20:02:28 +0000
commit5dc26cea082e5b88dd445ba0437d2dd2f9acefea (patch)
tree4a07f56d544aae76051e3f05498e6bdd051c2b50
parent3b317658e1a0484089f120efdb71da3822189934 (diff)
downloadllvm-5dc26cea082e5b88dd445ba0437d2dd2f9acefea.zip
llvm-5dc26cea082e5b88dd445ba0437d2dd2f9acefea.tar.gz
llvm-5dc26cea082e5b88dd445ba0437d2dd2f9acefea.tar.bz2
Merging r168320: into 3.2 relase branch.
Handle mixed normal and early-clobber defs on inline asm. PR14376. llvm-svn: 168527
-rw-r--r--llvm/lib/CodeGen/LiveInterval.cpp12
-rw-r--r--llvm/test/CodeGen/X86/inline-asm.ll7
2 files changed, 17 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/LiveInterval.cpp b/llvm/lib/CodeGen/LiveInterval.cpp
index c3bf2d2..8585cbb 100644
--- a/llvm/lib/CodeGen/LiveInterval.cpp
+++ b/llvm/lib/CodeGen/LiveInterval.cpp
@@ -59,8 +59,16 @@ VNInfo *LiveInterval::createDeadDef(SlotIndex Def,
return VNI;
}
if (SlotIndex::isSameInstr(Def, I->start)) {
- assert(I->start == Def && "Cannot insert def, already live");
- assert(I->valno->def == Def && "Inconsistent existing value def");
+ assert(I->valno->def == I->start && "Inconsistent existing value def");
+
+ // It is possible to have both normal and early-clobber defs of the same
+ // register on an instruction. It doesn't make a lot of sense, but it is
+ // possible to specify in inline assembly.
+ //
+ // Just convert everything to early-clobber.
+ Def = std::min(Def, I->start);
+ if (Def != I->start)
+ I->start = I->valno->def = Def;
return I->valno;
}
assert(SlotIndex::isEarlierInstr(Def, I->start) && "Already live at def");
diff --git a/llvm/test/CodeGen/X86/inline-asm.ll b/llvm/test/CodeGen/X86/inline-asm.ll
index e6eb9ef..d201ebd 100644
--- a/llvm/test/CodeGen/X86/inline-asm.ll
+++ b/llvm/test/CodeGen/X86/inline-asm.ll
@@ -52,3 +52,10 @@ entry:
%0 = call { i32, i32, i32, i32, i32 } asm sideeffect "", "=&r,=&r,=&r,=&r,=&q,r,~{ecx},~{memory},~{dirflag},~{fpsr},~{flags}"(i8* %h) nounwind
ret void
}
+
+; Mix normal and EC defs of the same register.
+define i32 @pr14376() nounwind noinline {
+entry:
+ %asm = tail call i32 asm sideeffect "", "={ax},i,~{eax},~{flags},~{rax}"(i64 61) nounwind
+ ret i32 %asm
+}