[LLVMbugs] [Bug 12567] New: Alias analysis confused by loop
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Apr 16 14:49:36 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=12567
Bug #: 12567
Summary: Alias analysis confused by loop
Product: libraries
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Global Analyses
AssignedTo: unassignedbugs at nondot.org
ReportedBy: jeroen.dobbelaere at synopsys.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 8394
--> http://llvm.org/bugs/attachment.cgi?id=8394
test file that shows the problem
Compile the attached file with:
clang -O3 -S test_alias.c
When p_a, p_b and p_c are initialized outside the loop, llvm is not able to
deduce that p_a, p_b and p_c will not alias. Because of that it will keep the
writes to '*p_c', resulting in slower code.
Note: If the initialization is done inside the loop, everything is fine.
Note: gcc is able to deduce that these will not alias in both cases.
Code that clang/llvm produces:
---
...
.file "test_alias_002.c"
.text
.globl foo_002
.align 16, 0x90
.type foo_002, at function
foo_002: # @foo_002
.cfi_startproc
# BB#0: # %entry
xorl %eax, %eax
.align 16, 0x90
.LBB0_1: # %for.body
# =>This Inner Loop Header: Depth=1
movl $0, c(%rax)
movl b(,%rax,4), %ecx
imull a(,%rax,4), %ecx
movl %ecx, c(%rax) #### Unnecessary store
movl b+4(,%rax,4), %edx
imull a+4(,%rax,4), %edx
addl %ecx, %edx
leaq 4(%rax), %rcx
movl %edx, c(%rax) #### Unnecessary store
movl b+8(,%rax,4), %esi
imull a+8(,%rax,4), %esi
addl %edx, %esi
movl %esi, c(%rax) #### Unnecessary store
movl b+12(,%rax,4), %edx
imull a+12(,%rax,4), %edx
addl %esi, %edx
cmpl $128, %ecx
movl %edx, c(%rax)
movq %rcx, %rax
jne .LBB0_1
# BB#2: # %for.end
ret
.Ltmp0:
...
---
--
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.
More information about the llvm-bugs
mailing list