Don't branch fold inline asm statements.

llvm-svn: 43191
This commit is contained in:
Bill Wendling 2007-10-19 21:09:55 +00:00
parent a87c9e4b75
commit ac5c93040f
3 changed files with 21 additions and 3 deletions

View File

@ -271,7 +271,8 @@ static unsigned ComputeCommonTailLength(MachineBasicBlock *MBB1,
unsigned TailLen = 0;
while (I1 != MBB1->begin() && I2 != MBB2->begin()) {
--I1; --I2;
if (!I1->isIdenticalTo(I2)) {
if (!I1->isIdenticalTo(I2) ||
I1->getOpcode() == TargetInstrInfo::INLINEASM) {
++I1; ++I2;
break;
}

View File

@ -1,5 +1,4 @@
// RUN: llvm-gcc -S %s -o /dev/null
// RUN: %llvmgcc -S %s -o /dev/null
void bork(void **data) {
(*(unsigned short *) (&(data[37])[927]) = 0);
}

View File

@ -0,0 +1,18 @@
; RUN: llvm-as < %s | opt -std-compile-opts -o - | llc -o - | grep bork_directive | wc -l | grep 2
;; We don't want branch folding to fold asm directives.
define void @bork(i32 %param) {
entry:
%tmp = icmp eq i32 %param, 0
br i1 %tmp, label %cond_true, label %cond_false
cond_true:
call void asm sideeffect ".bork_directive /* ${0:c}:${1:c} */", "i,i,~{dirflag},~{fpsr},~{flags}"( i32 37, i32 927 )
ret void
cond_false:
call void asm sideeffect ".foo_directive ${0:c}:${1:c}", "i,i,~{dirflag},~{fpsr},~{flags}"( i32 37, i32 927 )
call void asm sideeffect ".bork_directive /* ${0:c}:${1:c} */", "i,i,~{dirflag},~{fpsr},~{flags}"( i32 37, i32 927 )
ret void
}