When we optimize select basing on fact that div by 0 is undef
we should not traverse the instruction which are not guaranteed to
transfer execution to next instruction. Guard intrinsic is an example.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
test/Transforms/InstCombine/sdiv-guard.ll | ||
---|---|---|
1 ↗ | (On Diff #149247) | This test already passes without the patch. Please create a test that shows the diff and use utils/update_test_checks.py to generate checks for it. Also, we shouldn't need -inline to show a failure in instcombine. |
test/Transforms/InstCombine/sdiv-guard.ll | ||
---|---|---|
1 ↗ | (On Diff #149247) | Test actually shows the diff. Without this patch it will transform guard condition to %X != 0 which is incorrect because if X is not 0 and flag is false gaurd should be triggered. |
Comment Actions
LGTM - see inline comments.
lib/Transforms/InstCombine/InstCombineMulDivRem.cpp | ||
---|---|---|
586 ↗ | (On Diff #149388) | Typo: |
test/Transforms/InstCombine/sdiv-guard.ll | ||
1 ↗ | (On Diff #149247) | Ah, the assertions were just not strong enough then. I committed the baseline test here: Please remove the 'FIXME' and update/rebase the patch. |