This is an archive of the discontinued LLVM Phabricator instance.

[mlir][affine] Fix violation for uniqueness of value in scalrep pass.
AbandonedPublic

Authored by Lewuathe on Dec 25 2022, 10:58 PM.

Details

Summary

Scalrep pass expects the values in the given affine map are unique. But this expectation is not satisfied in case of the failure to eliminate redundant store operations before forwarding store to load. We should be able to eliminate all unused store operations before forwarding store to load in the scalrep pass to make sure the uniqueness of the value. This is the case reported in https://github.com/llvm/llvm-project/issues/59461.

Diff Detail

Event Timeline

Lewuathe created this revision.Dec 25 2022, 10:58 PM
Lewuathe requested review of this revision.Dec 25 2022, 10:58 PM
Herald added a project: Restricted Project. · View Herald Transcript
Lewuathe edited the summary of this revision. (Show Details)Dec 25 2022, 10:59 PM

The crash at https://github.com/llvm/llvm-project/issues/59461 is a bug that's just hidden with this change. Unused store elimination is currently done after store-to-load forward because that way you have fewer stores to look at (this should significantly speed up things on large bodies). In any case, this doesn't fix the bug that caused the assertion in https://github.com/llvm/llvm-project/issues/59461 - the input to store-to-load forwarding there is still a valid one with those two stores.

bondhugula requested changes to this revision.Jan 5 2023, 4:46 PM

As described here https://github.com/llvm/llvm-project/issues/59461#issuecomment-1372924955, this isn't the right fix; it only hides the issue. I should be able to post revisions to fix this later today.

This revision now requires changes to proceed.Jan 5 2023, 4:46 PM
bondhugula added a comment.EditedJan 8 2023, 9:25 PM

This fixes the assertion from addAffineIfOpDomain: https://reviews.llvm.org/D141250
And https://reviews.llvm.org/D141255 fixes the scalrep crash exposed and produces the desired simplification.

Lewuathe abandoned this revision.Jan 11 2023, 10:48 PM