http://llvm.org/bugs/show_bug.cgi?id=2262
Summary: volatile load should not be moved inside loop
Product: new-bugs
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: new bugs
AssignedTo: [EMAIL PROTECTED]
ReportedBy: [EMAIL PROTECTED]
CC: [email protected]
This is observed for recent SVN of llvm + gcc-4.2 on Ubuntu Feisty on x86-32.
This program:
volatile int g_1;
void loop (void)
{
int b;
for (b = 0; b < 10; b++)
{
g_1 += 5;
}
}
int foo (void)
{
loop ();
return g_1;
}
compiled like this:
llvm-gcc -Os -S -Wall small.c
gives this output:
foo:
pushl %ebp
movl %esp, %ebp
xorl %ecx, %ecx
movl g_1, %eax
.align 16
.LBB2_1: # bb
addl $5, %eax
movl %eax, g_1
incl %ecx
cmpl $10, %ecx
movl g_1, %eax
jne .LBB2_1 # bb
.LBB2_2: # bb9
popl %ebp
ret
The final move of g_1 into eax should be outside of the loop.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs