This is an archive of the discontinued LLVM Phabricator instance.

Adapting to hoisted bitcasts in CodeExtractor in IROutliner
ClosedPublic

Authored by AndrewLitteken on Jan 8 2021, 6:34 AM.

Details

Summary

In commit 700d2417d8281ea56dfd7ac72d1a1473d03d2d59 the CodeExtractor was updated so that bitcasts that have lifetime markers that beginning outside of the region are deduplicated outside the region and are not used as an output. This caused a discrepancy in the IROutliner, where in these cases there were arguments added to the aggregate function that were not needed causing assertion errors.

The IROutliner queries the CodeExtractor twice to determine the inputs and outputs, before and after findAllocas is called with the same ValueSet for the outputs causing the duplication. This has been fixed with a dummy ValueSet for the first call.

However, the additional bitcasts prevent us from using the same similarity relationships that were previously defined by the IR Similarity Analysis Pass. In these cases, we check whether the initial version of the region being analyzed for outlining is still the same as it was previously. If it is not, i.e. because of the additional bitcast instructions from the CodeExtractor, we discard the region.

Diff Detail

Event Timeline

AndrewLitteken created this revision.Jan 8 2021, 6:34 AM
AndrewLitteken requested review of this revision.Jan 8 2021, 6:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 8 2021, 6:34 AM
AndrewLitteken retitled this revision from Adapting to hoisted bitcasts in CodeExtractor to Adapting to hoisted bitcasts in CodeExtractor in IROutliner.Jan 8 2021, 6:35 AM
yroux added a subscriber: yroux.Jan 11 2021, 8:12 AM

One small comment otherwise LGTM

llvm/lib/Transforms/IPO/IROutliner.cpp
515

Maybe adding a small description in the comment above to explain why these outputs are not needed

yroux accepted this revision.Jan 13 2021, 6:57 AM

Approved now that I've properly tested it.

This revision is now accepted and ready to land.Jan 13 2021, 6:57 AM