This is a second part of D49974 that handles widening of conditional branches that
have very likely false branch.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/Transforms/Scalar/GuardWidening.cpp | ||
---|---|---|
526 ↗ | (On Diff #158975) | You should be able to handle this case by simply inverting Pred1 if InvertCondition is true. |
LGTM w/one required change before commit. I'm assuming the fix is 2-3 lines (basically adding a param pass through), if it's anything other than that, please come back for another round of review.
lib/Transforms/Scalar/GuardWidening.cpp | ||
---|---|---|
391 ↗ | (On Diff #159440) | It looks like you forgot to invert the condition when checking profit. Should be an easy fix, but add a test case which shows the problem too. |
lib/Transforms/Scalar/GuardWidening.cpp | ||
---|---|---|
391 ↗ | (On Diff #159440) | I'm not sure what do you mean. This function only checks if we are hoisting out of loop or not and availability of condition at candidate's point. How can inversion of condition affect that? |
lib/Transforms/Scalar/GuardWidening.cpp | ||
---|---|---|
391 ↗ | (On Diff #159440) | Just realized that isWideningCondProfitable does a really ugly thing inside and may end up creating instructions. I will propagate the inversion flag there, but it must be rework in the follow-up. |