This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Prevent infinite loop after D129980.
ClosedPublic

Authored by craig.topper on Aug 3 2022, 1:32 PM.

Details

Summary

D129980 converts (seteq (i64 (and X, 0xffffffff)), C1) into
(seteq (i64 (sext_inreg X, i32)), C1). If bit 31 of X is 0, it
will be turned back into an 'and' by SimplifyDemandedBits which
can cause an infinite loop.

To prevent this, check if bit 31 is 0 with computeKnownBits before
doing the transformation.

Fixes PR56905.

Diff Detail

Event Timeline

craig.topper created this revision.Aug 3 2022, 1:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 3 2022, 1:32 PM
craig.topper requested review of this revision.Aug 3 2022, 1:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 3 2022, 1:32 PM
reames accepted this revision.Aug 3 2022, 2:36 PM

LGTM

This revision is now accepted and ready to land.Aug 3 2022, 2:36 PM
This revision was landed with ongoing or failed builds.Aug 3 2022, 3:21 PM
This revision was automatically updated to reflect the committed changes.