This is an archive of the discontinued LLVM Phabricator instance.

[BitcodeReader] Delay select until all constants resolved
ClosedPublic

Authored by guopeilin on Sep 1 2021, 4:21 AM.

Details

Summary

Like the shuffle, we should treat the select delayed so that all constants can be resolved.

Diff Detail

Event Timeline

guopeilin created this revision.Sep 1 2021, 4:21 AM
guopeilin requested review of this revision.Sep 1 2021, 4:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 1 2021, 4:21 AM
guopeilin edited the summary of this revision. (Show Details)Sep 1 2021, 4:40 AM
guopeilin added reviewers: wwei, mdchen, efriedma, spatel, dmgreen.
efriedma added inline comments.Sep 1 2021, 1:19 PM
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
2722

Maybe it would simplify the algorithm if you ValueList.getConstantFwdRef(NextCstNo, CurTy); here? That way, indexing into ValueList later would never fail.

guopeilin updated this revision to Diff 370790.Sep 5 2021, 3:57 AM
guopeilin edited the summary of this revision. (Show Details)
guopeilin added inline comments.
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
2722

Ok,thanks for reviewing. A new patch updated.

guopeilin updated this revision to Diff 370835.Sep 5 2021, 8:07 PM
guopeilin updated this revision to Diff 370867.Sep 6 2021, 2:27 AM

Pinging reviewers ...

efriedma added inline comments.Sep 7 2021, 3:25 PM
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
2360

SelectorTy is always i1; no need to store it here.

llvm/lib/Bitcode/Reader/ValueList.cpp
155 ↗(On Diff #370867)

Why is this change necessary? If we're sticking a value into ResolveConstants that isn't a placeholder, something has gone wrong, I think.

guopeilin updated this revision to Diff 371319.Sep 8 2021, 5:19 AM
guopeilin added inline comments.
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
2360

fixed

llvm/lib/Bitcode/Reader/ValueList.cpp
155 ↗(On Diff #370867)

In the previous patch, which we parse select repeatedly, will generate some cases that placeholder become the exact RealVal.
However, in the new patch, this is not need any more.

efriedma accepted this revision.Sep 8 2021, 3:44 PM

LGTM

This revision is now accepted and ready to land.Sep 8 2021, 3:44 PM