This patch implements initial support for freeze instructions in
[IP]SCCP.
If the operand is known to be undef, exit early and wait until it
changes. If it stays undef until the end of solving, resolvedUndefsIn
will take care of handling it. At the moment, it will be marked as
overdefined.
Otherwise just merge in the value of the operand.
Let's assume %x is poison here, then %and is poison and %and.fr can take any value, while you assume that it must be in [0,3].
Here's an example of how this goes wrong across multiple passes:
declare void @use(i64) define internal i1 @test(i64 %a) { %b = or i64 %a, 2 %x = freeze i64 %b call void @use(i64 %x) %c = icmp eq i64 %x, 0 ret i1 %c } define i1 @test2() { %c = call i1 @test(i64 poison) ret i1 %c } ; opt -S -sccp -inline -instcombine define i1 @test2() { call void @use(i64 0) ret i1 false }As you can see, we both claim that %x != 0 and pass %x == 0 to @use(). This example uses -sccp to make sure SCCP doesn't have a global view.