https://bugs.llvm.org/show_bug.cgi?id=41497
Bug ID: 41497
Summary: Missing optimization, elimination of empty data
dependant loops
Product: clang
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangb...@nondot.org
Reporter: gar...@ignition-web.co.uk
CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
neeil...@live.com, richard-l...@metafoo.co.uk
void * x;
void test(){ for(void * p = x; p; p=*(void**)p); }
With -O3 gives:
test(): # @test()
mov rax, qword ptr [rip + x]
test rax, rax
je .LBB0_3
.LBB0_1: # =>This Inner Loop Header: Depth=1
mov rax, qword ptr [rax]
test rax, rax
jne .LBB0_1
.LBB0_3:
ret
As you can see it currently traverses pointers even though it could be
optimized away.
6.8.2.2 Forward progress
The implementation may assume that any thread will eventually do one of the
following:
(1.1) terminate,
(1.2) make a call to a library I/O function,
(1.3) perform an access through a volatile glvalue, or
(1.4) perform a synchronization operation or an atomic operation.
[ Note: This is intended to allow compiler transformations such as removal of
empty loops, even when termination cannot be proven. — end note ]
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs