This is an archive of the discontinued LLVM Phabricator instance.

[IndVars][NFCI] Avoid supposedly redundant query to save some CT
AbandonedPublic

Authored by mkazantsev on Dec 12 2022, 1:20 AM.

Details

Summary

I ran a big corps of Fuzz tests and could not find a case when predicate
evaluated to 'false' would fire here, seems that they all get optimized away
by other means. We also don't have a unit test that would show it's useful.

I am not 100% sure this is an NFC, but if it really causes any troubles, we
should add a test demonstrating it's useful. Otherwise, we save some CT
by reducing number of SCEV queries.

Diff Detail

Event Timeline

mkazantsev created this revision.Dec 12 2022, 1:20 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 12 2022, 1:20 AM
mkazantsev requested review of this revision.Dec 12 2022, 1:20 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 12 2022, 1:20 AM
mkazantsev retitled this revision from [IndVars][NFCI] Remove supposedly dead code to save some CT to [IndVars][NFCI] Avoid supposedly redundant query to save some CT.Dec 12 2022, 1:24 AM
nikic added inline comments.Dec 12 2022, 1:30 AM
llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
1386–1388

Was this supposed to be isKnownPredicateAt?

mkazantsev added inline comments.Dec 12 2022, 1:38 AM
llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
1386–1388

Yes... Haven't committed the last revision of patch :(

nikic added inline comments.Dec 12 2022, 1:42 AM
llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
1387

If I put an assert(*EV) here, I get an assertion failure in llvm/test/Transforms/IndVarSimplify/2014-06-21-congruent-constant.ll. So it looks like this can trigger. Unfortunately this is a test chock full of UB, but maybe it's possible to extract a more meaningful test from it?

Fixed comment

mkazantsev planned changes to this revision.Dec 12 2022, 1:43 AM

I'll study this more, maybe it's not dead indeed.

mkazantsev added inline comments.Dec 12 2022, 1:46 AM
llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
1387

Failing assertion doesn't mean it can't be optimized by other means, but need more study.

lebedev.ri resigned from this revision.Jan 12 2023, 4:59 PM

This review may be stuck/dead, consider abandoning if no longer relevant.
Removing myself as reviewer in attempt to clean dashboard.

mkazantsev abandoned this revision.Jan 27 2023, 5:07 AM