This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Add check for value that might be null.
ClosedPublic

Authored by jacquesguan on Jan 13 2023, 12:08 AM.

Details

Summary

Because we are generating uninitialized value for no integer type and use isUninitialized() to judge if it is valid after https://reviews.llvm.org/rG93f081c896536112e1ca8133991d23cb1134793a, we should check the value before use getValue to get it.
Fixes https://github.com/llvm/llvm-project/issues/59984.

Diff Detail

Event Timeline

jacquesguan created this revision.Jan 13 2023, 12:08 AM
jacquesguan requested review of this revision.Jan 13 2023, 12:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 13 2023, 12:08 AM

I don't understand how this fixes the issue. How are you able to dereference an uninitialized optional?

Change to check.

jacquesguan retitled this revision from [mlir] Remove wrong assertion. to [mlir] Add check for value that might be null..Feb 15 2023, 12:02 AM
jacquesguan edited the summary of this revision. (Show Details)

I don't understand how this fixes the issue. How are you able to dereference an uninitialized optional?

I change this patch to do check before use to avoid crash.

Please add a test

Please add a test

Done.

Mogball accepted this revision.Feb 15 2023, 10:33 PM
This revision is now accepted and ready to land.Feb 15 2023, 10:33 PM
This revision was automatically updated to reflect the committed changes.