This is an archive of the discontinued LLVM Phabricator instance.

[MLIR] Add an assert in Operation::getOpResultImpl for out of range result
ClosedPublic

Authored by xgupta on Apr 9 2023, 6:53 AM.

Details

Summary

This fix https://github.com/llvm/llvm-project/issues/61962.

Calling op->getResult(0) on a function like operation with no results
returned a garbage pointer.

This patch add assert to check number is in range.

Diff Detail

Event Timeline

xgupta created this revision.Apr 9 2023, 6:53 AM
Herald added a project: Restricted Project. · View Herald Transcript
xgupta requested review of this revision.Apr 9 2023, 6:53 AM
xgupta updated this revision to Diff 512002.Apr 9 2023, 6:54 AM

update with clang-format

The assert should be at the top of the function

xgupta updated this revision to Diff 512020.Apr 9 2023, 9:08 AM

address comment

rriddle accepted this revision.Apr 9 2023, 12:00 PM

Nice job with the fix!

This revision is now accepted and ready to land.Apr 9 2023, 12:00 PM
This revision was landed with ongoing or failed builds.Apr 9 2023, 1:20 PM
This revision was automatically updated to reflect the committed changes.
xgupta added a comment.Apr 9 2023, 1:21 PM

Thanks for reviewing on sunday :-)
Happy day!

xgupta added a comment.Apr 9 2023, 9:17 PM

Hi,

It seems it broke buildbot for Dialect/SparseTensor/codegen.mlir test case and some other flang testcase also.

I am not sure how to fix those, Someone with MLIR knowledge PTAL otherwise feel free to revert it if requires.

Hi,

It seems it broke buildbot for Dialect/SparseTensor/codegen.mlir test case and some other flang testcase also.

I am not sure how to fix those, Someone with MLIR knowledge PTAL otherwise feel free to revert it if requires.

If a bot is broken and you don't have an immediate fix: please revert immediately!

(also: you have pre-merge testing happening on Phabricator revision that can hint at some of these before pushing)

Thanks for the revert.

Seems @frgossen fixed the SparseTensor issue, can someone from Flang team take a look at this buildbot - https://lab.llvm.org/buildbot/#/builders/197/builds/4476.
The issue might be at -
https://github.com/llvm/llvm-project/blob/d374d474698001784d0bc0fce4ddfd08fe7d3545/flang/lib/Lower/ConvertCall.cpp#L222 or maybe somewhere in flang/lib/Lower/ConvertExpr.cpp.

CC @clementval @jeanPerier

Thanks for the revert.

Seems @frgossen fixed the SparseTensor issue, can someone from Flang team take a look at this buildbot - https://lab.llvm.org/buildbot/#/builders/197/builds/4476.
The issue might be at -
https://github.com/llvm/llvm-project/blob/d374d474698001784d0bc0fce4ddfd08fe7d3545/flang/lib/Lower/ConvertCall.cpp#L222 or maybe somewhere in flang/lib/Lower/ConvertExpr.cpp.

CC @clementval @jeanPerier

This would be fixed by D147959

xgupta reopened this revision.Apr 11 2023, 12:33 AM
This revision is now accepted and ready to land.Apr 11 2023, 12:33 AM