This is an archive of the discontinued LLVM Phabricator instance.

[SLP]Fix PR55688: Miscompile due to incorrect nuw handling.
ClosedPublic

Authored by ABataev on May 25 2022, 5:30 AM.

Details

Summary

Need gto use all ReductionOps when propagating flags for the reduction
ops, otherwise transformation is not correct.

Diff Detail

Event Timeline

ABataev created this revision.May 25 2022, 5:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 25 2022, 5:30 AM
ABataev requested review of this revision.May 25 2022, 5:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 25 2022, 5:30 AM

I'm not sure how this patch works on the given example, but I don't think it is sufficient.

We probably need to do what was suggested in the bug report - do not propagate flags when creating reduction ops.

We should add minimal tests that exercise these paths. For example, I don't think the patch works on this test:
https://alive2.llvm.org/ce/z/oZ703c

ABataev updated this revision to Diff 432034.May 25 2022, 10:01 AM

Address comments.

I don't know if this exercises any different paths, but I added the test that I suggested here:
d3187dd5f0f0
...because other regression tests in these files are not reduced enough to easily verify with Alive2.

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
10329–10330

Adjust this description.

10350–10351

Can this one also cause trouble?

ABataev updated this revision to Diff 432054.May 25 2022, 11:20 AM

Address comments

ABataev updated this revision to Diff 432055.May 25 2022, 11:22 AM

Removed fixed FIXME

ABataev marked 2 inline comments as done.May 25 2022, 11:23 AM
ABataev added inline comments.
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
10350–10351

Removed it, not used anymore.

spatel accepted this revision.May 25 2022, 11:34 AM

Change patch title before committing to mention 'nsw'
I'm not sure if we can actually expose a bug with 'nuw':
https://alive2.llvm.org/ce/z/bRVPr_
...but we can restore that if it matters.
LGTM

This revision is now accepted and ready to land.May 25 2022, 11:34 AM
This revision was landed with ongoing or failed builds.May 25 2022, 2:00 PM
This revision was automatically updated to reflect the committed changes.
ABataev marked an inline comment as done.