[CodeExtractor] Fix extraction of a value used only by intrinsics outside of region
We should only skip `lifetime` and `dbg` intrinsics when searching for users. Other intrinsics are legit users that can't be ignored. Without this fix, the testcase would result in an invalid IR. `memcpy` will have a reference to the, now, external value (local to the extracted loop function). Fix PR42194 Differential Revision: https://reviews.llvm.org/D78749
This commit is contained in:
@@ -451,18 +451,24 @@ CodeExtractor::getLifetimeMarkers(const CodeExtractorAnalysisCache &CEAC,
|
||||
for (User *U : Addr->users()) {
|
||||
IntrinsicInst *IntrInst = dyn_cast<IntrinsicInst>(U);
|
||||
if (IntrInst) {
|
||||
// We don't model addresses with multiple start/end markers, but the
|
||||
// markers do not need to be in the region.
|
||||
if (IntrInst->getIntrinsicID() == Intrinsic::lifetime_start) {
|
||||
// Do not handle the case where Addr has multiple start markers.
|
||||
if (Info.LifeStart)
|
||||
return {};
|
||||
Info.LifeStart = IntrInst;
|
||||
continue;
|
||||
}
|
||||
if (IntrInst->getIntrinsicID() == Intrinsic::lifetime_end) {
|
||||
if (Info.LifeEnd)
|
||||
return {};
|
||||
Info.LifeEnd = IntrInst;
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
// At this point, permit debug uses outside of the region.
|
||||
// This is fixed in a later call to fixupDebugInfoPostExtraction().
|
||||
if (isa<DbgInfoIntrinsic>(IntrInst))
|
||||
continue;
|
||||
}
|
||||
// Find untracked uses of the address, bail.
|
||||
if (!definedInRegion(Blocks, U))
|
||||
|
||||
Reference in New Issue
Block a user