This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Fix handling of some region branch terminator successors
ClosedPublic

Authored by Mogball on Jun 7 2022, 5:04 PM.

Details

Summary

When RegionBranchOpInterface::getSuccessorRegions is called for anything other than the parent op, it expects the operands of the terminator of the source region to be passed, not the operands of the parent op. This was not always respected.

This fixes a bug in integer range inference and ForwardDataFlowSolver and changes scf.while to allow narrowing of successors using constant inputs.

Fixes #55873

Diff Detail

Event Timeline

Mogball created this revision.Jun 7 2022, 5:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 7 2022, 5:04 PM
Mogball requested review of this revision.Jun 7 2022, 5:04 PM
mehdi_amini accepted this revision.Jun 7 2022, 7:13 PM

LG but please wait for one another review here, I only skim through it.

This revision is now accepted and ready to land.Jun 7 2022, 7:13 PM
krzysz00 accepted this revision.Jun 8 2022, 8:35 AM

I think the semantics of DataFlowAnalysis::getSuccessorsForOperands() could be clarified ... but I'm not sure it matters, since there're plans to scrap that entire framework.

mlir/lib/Analysis/IntRangeAnalysis.cpp
224

Looking here and below, is there call for a helper to iterate over the block terminators directly?

Mogball marked an inline comment as done.Jun 8 2022, 8:53 AM

Yeah someone actually reported issues internally to me yesterday just as I was wrapping up this fix. The old framework will go away soon^TM.

mlir/lib/Analysis/IntRangeAnalysis.cpp
224

Don't think so..

Mogball marked an inline comment as done.Jun 8 2022, 8:54 AM
This comment was removed by Mogball.

So yeah, from the perspective of the integer range stuff, feel free to land
this.