diff --git a/IGC/AdaptorCommon/LivenessUtils/AllocationLivenessAnalyzer.cpp b/IGC/AdaptorCommon/LivenessUtils/AllocationLivenessAnalyzer.cpp index e97778e7c..759c6d9e9 100644 --- a/IGC/AdaptorCommon/LivenessUtils/AllocationLivenessAnalyzer.cpp +++ b/IGC/AdaptorCommon/LivenessUtils/AllocationLivenessAnalyzer.cpp @@ -401,6 +401,12 @@ static bool tryFindPointerOrigin(GetElementPtrInst *Ptr, SmallVectorImplgetPointerOperand(), origins, cache); } +static bool tryFindPointerOrigin(SelectInst *Ptr, SmallVectorImpl &origins, + DenseSet &cache) { + return tryFindPointerOriginImpl(Ptr->getTrueValue(), origins, cache) && + tryFindPointerOriginImpl(Ptr->getFalseValue(), origins, cache); +} + static bool tryFindPointerOriginImpl(Value *ptr, SmallVectorImpl &origins, DenseSet &cache) { if (!cache.insert(ptr).second) return true; @@ -409,6 +415,10 @@ static bool tryFindPointerOriginImpl(Value *ptr, SmallVectorImpl return tryFindPointerOrigin(GEP, origins, cache); } + if (auto *select = dyn_cast(ptr)) { + return tryFindPointerOrigin(select, origins, cache); + } + if (auto *allocaI = dyn_cast(ptr)) { origins.push_back(allocaI); return true;