[llvm-bugs] [Bug 41988] New: Missing opt with ctlz and shifts of power of 2 constants
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed May 22 18:24:01 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=41988
Bug ID: 41988
Summary: Missing opt with ctlz and shifts of power of 2
constants
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: Matthew.Arsenault at amd.com
CC: llvm-bugs at lists.llvm.org
It should be possible to eliminate a ctlz of a shift of a power of 2 by turning
it into an add:
declare i32 @llvm.ctlz.i32(i32, i1)
define i32 @foo(i32 %log2) {
%div = lshr i32 8387584, %log2
%ctlz = call i32 @llvm.ctlz.i32(i32 %div, i1 false)
ret i32 %ctlz
}
define i32 @bar(i32 %log2) {
%ctlz.const = call i32 @llvm.ctlz.i32(i32 8387584, i1 false)
%add = add i32 %log2, %ctlz.const
ret i32 %add
}
define void @test() {
%foo = call i32 @foo(i32 6)
store volatile i32 %foo, i32* undef
%bar = call i32 @bar(i32 6)
store volatile i32 %bar, i32* undef
ret void
}
--
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/20190523/5310cd70/attachment.html>
More information about the llvm-bugs
mailing list