This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Refactor out OptimizeOverflowCheck. NFCI.
ClosedPublic

Authored by sanjoy on Apr 7 2015, 8:25 PM.

Details

Summary

This patch adds an enum OverflowCheckFlavor and a function
OptimizeOverflowCheck. This will allow InstCombine to optimize
overflow checks without directly introducing an intermediate call to the
llvm.$op.with.overflow instrinsics.

This specific change is a refactoring and does not intend to change
behavior.

Diff Detail

Event Timeline

sanjoy updated this revision to Diff 23390.Apr 7 2015, 8:25 PM
sanjoy retitled this revision from to [InstCombine] Refactor out OptimizeOverflowCheck. NFCI..
sanjoy updated this object.
sanjoy edited the test plan for this revision. (Show Details)
sanjoy added reviewers: majnemer, atrick.
sanjoy added a subscriber: Unknown Object (MLST).
atrick accepted this revision.Apr 7 2015, 8:55 PM
atrick edited edge metadata.

Neat. LGTM.

I didn't carefully parse all of the logic, but I accept that it is no functional change intended.

lib/Transforms/InstCombine/InstCombineInternal.h
123

Maybe just OCF_INVALID.
Stick with the "OCF" prefix, and "MAX" can be confused with an operation.

440–441

Stale comment

This revision is now accepted and ready to land.Apr 7 2015, 8:55 PM
This revision was automatically updated to reflect the committed changes.