Page MenuHomePhabricator

[mlir] Add integer range analysis to SCCP
AbandonedPublic

Authored by krzysz00 on Jun 2 2022, 1:08 PM.

Details

Reviewers
rriddle
Mogball
Summary

This integrates the scalar integer analysis recently added to MLIR
into the SCCP pass, allowing for more substantial constant
propagation (as values that can be logically proven constant will be
made constant) in a way that mirrors LLVM's SCCP pass, and eliminating
the need for a test pass.

A motivating example for the new logic is the comparison
operations (and their associated selects) emitted by
expandAffineMap() for the modulus operator, which can be substantially
in the presence of proof that the input to the modulus argument is
non-negative.

Depends on D124022

Diff Detail

Event Timeline

krzysz00 created this revision.Jun 2 2022, 1:08 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 2 2022, 1:08 PM
krzysz00 requested review of this revision.Jun 2 2022, 1:08 PM

delete the pass itself?

I don't think we can delete old SCCP - range analysis doesn't handle vectors, for example

Oh I meant the test pass. I didn't see that the file was removed :P

Mogball added inline comments.Jun 4 2022, 10:24 AM
mlir/lib/Transforms/SCCP.cpp
288

rangeAnalysis.run(op)?

Mogball accepted this revision.Jun 4 2022, 10:26 AM
Mogball added inline comments.
mlir/lib/Transforms/SCCP.cpp
288

Ah, nevermind. I didn't see this was changed.

This revision is now accepted and ready to land.Jun 4 2022, 10:26 AM
rriddle requested changes to this revision.EditedJun 4 2022, 10:37 AM

From a quick first pass we should really avoid building multiple analysis if we can. Each analysis is going to do full passes of the IR. I wonder if we could work it so that the analysis are built simultaneously, so we don't have to do two full passes of the IR.

This revision now requires changes to proceed.Jun 4 2022, 10:37 AM
krzysz00 abandoned this revision.Jul 5 2022, 8:44 AM

Since @Mogball is handling this in his dataflow analysis rework, abandoning.