This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombiner] Fix issue with rot chain pattern
ClosedPublic

Authored by bcl5980 on Jan 10 2023, 2:06 AM.

Details

Summary

faa35fc87370 fix the case of negative input shift. But when c1, c2 is not the same side, it will also cause negative shift amount.
And that negative shift amount can't normalize by urem. So add one more bit size to normalize the last shift amount.

Fix: https://github.com/llvm/llvm-project/issues/59898

Diff Detail

Event Timeline

bcl5980 created this revision.Jan 10 2023, 2:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 10 2023, 2:06 AM
bcl5980 requested review of this revision.Jan 10 2023, 2:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 10 2023, 2:06 AM

Please can you rebase? I've updated the tests so the patch should just show the codegen diff

bcl5980 updated this revision to Diff 487776.Jan 10 2023, 6:22 AM

rebase code

RKSimon accepted this revision.Jan 10 2023, 7:09 AM

LGTM with one minor - cheers

llvm/test/CodeGen/AArch64/rotate.ll
21

;; This used to cause a miscompile because rot combine

This revision is now accepted and ready to land.Jan 10 2023, 7:09 AM
bcl5980 updated this revision to Diff 487842.Jan 10 2023, 9:27 AM
This revision was landed with ongoing or failed builds.Jan 10 2023, 9:29 AM
This revision was automatically updated to reflect the committed changes.