[llvm-bugs] [Bug 43158] New: Failure to exploit assume to eliminate use of load
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Aug 28 19:39:20 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=43158
Bug ID: 43158
Summary: Failure to exploit assume to eliminate use of load
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: listmail at philipreames.com
CC: llvm-bugs at lists.llvm.org
Test case:
define i32 @test(i32* %p, i32 %v) {
%load = load i32, i32* %p
%c = icmp eq i32 %load, %v
call void @llvm.assume(i1 %c)
ret i32 %load
}
define i32 @reverse(i32* %p, i32 %v) {
%load = load i32, i32* %p
%c = icmp eq i32 %load, %v
call void @llvm.assume(i1 %c)
ret i32 %v
}
declare void @llvm.assume(i1)
Both of these examples are stable under O3; we really should be canonicalizing
to one or the other. In this particular example, reverse is the better of the
two, but a general heuristic requires more thought.
GVN's propagateEquality has a "prefer early valno" heuristic which appears
reasonable. GVN has a separate constant replacement in operands heuristic
which also seems reasonable. I suspect these two need to be unified into
something of a broader scope.
--
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/20190829/542546bf/attachment-0001.html>
More information about the llvm-bugs
mailing list