[LLVMbugs] [Bug 23809] New: InstCombine should keep useful @llvm.assume calls
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Jun 10 09:56:30 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=23809
Bug ID: 23809
Summary: InstCombine should keep useful @llvm.assume calls
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: wujingyue at gmail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 14461
--> https://llvm.org/bugs/attachment.cgi?id=14461&action=edit
the test case as mentioned in the description
I have some WIP that leverages @llvm.assume in some optimization passes other
than InstCombine. However, it doesn't work yet because InstCombine removes
@llvm.assume calls that are useful for later optimizations. For example, given
define i32 @foo(i32 %a, i32 %b) {
%sum = add i32 %a, %b
%1 = icmp sge i32 %sum, 0
call void @llvm.assume(i1 %1)
ret i32 %sum
}
"opt -instcombine" emits
define i32 @foo(i32 %a, i32 %b) {
%sum = add i32 %a, %b
ret i32 %sum
}
removing the @llvm.assume call so later optimizations won't know sum is
non-negative any more. (Note that the opt I use here is with
http://reviews.llvm.org/D10283 patched. This patch fixes a bug in
ValueTracking).
The reasons that InstCombine removes this assume call are:
1) SimplifyICmpInst proves %1 is true based on the assume call.
2) then, InstCombine
(http://llvm.org/docs/doxygen/html/InstCombineCompares_8cpp_source.html#l02649)
replaces all uses of %1 with true including the use in the assume call.
3) Somewhere later, llvm.assume(true) is considered trivially dead and thus
removed from the IR.
--
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/20150610/c0cff037/attachment.html>
More information about the llvm-bugs
mailing list