-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Description
| Bugzilla Link | 43158 |
| Version | trunk |
| OS | Linux |
Extended Description
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.