This is an archive of the discontinued LLVM Phabricator instance.

[ConstraintElimination] Simplify usub(a,b) if a s>=b.
Needs ReviewPublic

Authored by zjaffal on Sep 16 2022, 7:30 AM.

Details

Summary

This optimization follows the work from D125264

Diff Detail

Event Timeline

zjaffal created this revision.Sep 16 2022, 7:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 16 2022, 7:30 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
zjaffal requested review of this revision.Sep 16 2022, 7:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 16 2022, 7:30 AM
nikic added a comment.Dec 8 2022, 7:25 AM

Looks fine, but I think you need to rebase and adjust this line to check for WithOverflowInst instead: https://github.com/llvm/llvm-project/blob/286ae63e168b5e5249bf52e2f1610057d604bab4/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp#L665

Looks fine, but I think you need to rebase and adjust this line to check for WithOverflowInst instead: https://github.com/llvm/llvm-project/blob/286ae63e168b5e5249bf52e2f1610057d604bab4/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp#L665

We check for WithOverflowInst before we call tryToSimplifyOverflowMath so I don't think it is needed there

nikic added a comment.Dec 23 2022, 2:46 PM

Looks fine, but I think you need to rebase and adjust this line to check for WithOverflowInst instead: https://github.com/llvm/llvm-project/blob/286ae63e168b5e5249bf52e2f1610057d604bab4/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp#L665

We check for WithOverflowInst before we call tryToSimplifyOverflowMath so I don't think it is needed there

What I meant is, if this code is not adjusted the condition will not get queued up for simplification in the first place.