This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Transform `(shift X,Or(Y,BitWidth-1))` -> `(shift X,BitWidth-1)`
ClosedPublic

Authored by goldstein.w.n on Mar 5 2023, 12:17 PM.

Diff Detail

Event Timeline

goldstein.w.n created this revision.Mar 5 2023, 12:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 5 2023, 12:17 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
goldstein.w.n requested review of this revision.Mar 5 2023, 12:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 5 2023, 12:17 PM
nikic added inline comments.Mar 5 2023, 12:22 PM
llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
492

Can also propagate the exact flag. At which point using replaceOperand() might actually be cleaner for once.

goldstein.w.n marked an inline comment as done.Mar 5 2023, 12:50 PM

Use replaceOperand to propegate exact flag + simplifiy logic

nikic accepted this revision.Mar 5 2023, 2:04 PM

LGTM, but please precommit the tests.

This revision is now accepted and ready to land.Mar 5 2023, 2:04 PM