This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Avoid infinite loop between DAGCombiner::visitMUL and RISCVISelLowering::transformAddImmMulImm
ClosedPublic

Authored by asb on Feb 22 2022, 8:34 AM.

Details

Summary

See https://github.com/llvm/llvm-project/issues/53831 for a full discussion.

The basic issue is that DAGCombiner::visitMUL and RISCVISelLowering;:transformAddImmMullImm get stuck in a loop, as the current checks in transformAddImmMulImm aren't sufficient to avoid all cases where DAGCombiner::isMulAddWithConstProfitable might trigger a transformation. This patch makes transformAddImmMulImm bail out if C0 (the constant used for multiplication) has more than one use.

Diff Detail

Event Timeline

asb created this revision.Feb 22 2022, 8:34 AM
asb requested review of this revision.Feb 22 2022, 8:34 AM
This revision is now accepted and ready to land.Feb 22 2022, 10:50 AM
benshi001 accepted this revision.Feb 22 2022, 6:50 PM

Thanks for fixing the issue introduced by me.