This is an archive of the discontinued LLVM Phabricator instance.

[ConstraintElimination] Make decompose() infallible
ClosedPublic

Authored by nikic on Nov 11 2022, 8:04 AM.

Details

Summary

decompose() currently returns a mix of {} and 0 + 1*V on failure. I don't really follow why we use one over the other in some cases. It seems like it would be better to make decompose() infallible and always return 0 + 1*V is we can't decompose the value further.

Diff Detail

Event Timeline

nikic created this revision.Nov 11 2022, 8:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 11 2022, 8:04 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
nikic requested review of this revision.Nov 11 2022, 8:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 11 2022, 8:04 AM
nikic updated this revision to Diff 474775.Nov 11 2022, 8:13 AM

Remove one more check.

fhahn accepted this revision.Nov 11 2022, 4:00 PM
fhahn added reviewers: zjaffal, fcloutier.

LGTM, thanks!

IIRC the main reason was that {} originally was more compact. With respect to correctness, always returning 0 + V is fine and in combination with the constructors from D137848 the code will end up still compact.

This revision is now accepted and ready to land.Nov 11 2022, 4:00 PM
This revision was landed with ongoing or failed builds.Nov 14 2022, 1:42 AM
This revision was automatically updated to reflect the committed changes.