This implements the same basic change as D94859, but in a more general way. directlyImpliesPoison recurses on V, impliesPoison recurses on ValAssumedPoison. Both recursions have independent small depth limits. This allows us to handle more than just the icmp+icmp case, such as the mask+icmp case for example.
Details
Diff Detail
Event Timeline
Okay, I agree that this is more general.
I was cautious about possible compile time degradation - do you have a number for this?
unittests/Analysis/ValueTrackingTest.cpp | ||
---|---|---|
783 | Maybe icmp eq i32 %M2, 1 here? (similarly below) | |
790 | Shall we have one more example that has EXPECT_FALSE because ValAssumedPoison was e.g. icmp eq %x, %z where z wasn't used by A? |
Compile-time results (on top of flipping the select optimization flag, otherwise it would not get called): https://llvm-compile-time-tracker.com/compare.php?from=0c9e135ecde32b57393fb502cc45f90c2a17346d&to=3d7dcc78542627d6440613327f21d177bcdf6f00&stat=instructions There does not seem to be any impact above noise.
unittests/Analysis/ValueTrackingTest.cpp | ||
---|---|---|
783 | Yes, this test didn't make sense... | |
790 | I think this case is checked by the existing impliesPoisonTest_ICmpUnknown test. It uses icmp eq i32 %x, %y and icmp eq i32 %x, 1. |
Maybe icmp eq i32 %M2, 1 here? (similarly below)