[llvm-bugs] [Bug 50550] New: Loop simplification with invariant code
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jun 1 02:30:01 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=50550
Bug ID: 50550
Summary: Loop simplification with invariant code
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: david.bolvansky at gmail.com
CC: llvm-bugs at lists.llvm.org
#include <stddef.h>
bool s;
bool test1() {
bool r = false;
for(size_t i = 0; i < 1; ++i) {
if (s)
r = true;
}
return r;
}
bool test2() {
bool r = false;
for(size_t i = 0; i < 2; ++i) {
if (s)
r = true;
}
return r;
}
test1(): # @test1()
cmp byte ptr [rip + s], 0
setne al
ret
test2(): # @test2()
mov al, byte ptr [rip + s]
ret
s:
.byte 0 # 0x0
https://godbolt.org/z/rGv7z9q5W
BTW, LLVM 12 and lower produces same ideal codegen for both functions
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210601/070b4635/attachment.html>
More information about the llvm-bugs
mailing list