This is an archive of the discontinued LLVM Phabricator instance.

[InstSimplify] Simplify `(shl nsw nuw X, BitWidth - 1)` -> `0`
ClosedPublic

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

Diff Detail

Event Timeline

goldstein.w.n created this revision.Mar 5 2023, 12:18 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 5 2023, 12:18 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
goldstein.w.n requested review of this revision.Mar 5 2023, 12:18 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 5 2023, 12:18 PM
nikic accepted this revision.Mar 6 2023, 1:43 AM

LG

llvm/lib/Analysis/InstructionSimplify.cpp
1448

Spurious space after *.

This revision is now accepted and ready to land.Mar 6 2023, 1:43 AM
spatel added inline comments.Mar 6 2023, 5:39 AM
llvm/lib/Analysis/InstructionSimplify.cpp
1466

This could use an explanatory code comment, so we don't have to refer back to the no-wrap definitions:

// "nuw" guarantees that only zeros are shifted out, and "nsw" guarantees 
// that the sign-bit does not change, so the only input that does not 
// produce poison is 0, and "0 << (bitwidth-1) --> 0".
goldstein.w.n marked 2 inline comments as done.Mar 6 2023, 10:27 AM

Add comment, fix style

spatel accepted this revision.Mar 6 2023, 10:37 AM
This revision was landed with ongoing or failed builds.Mar 6 2023, 6:31 PM
This revision was automatically updated to reflect the committed changes.