mirror of
https://github.com/intel/intel-graphics-compiler.git
synced 2025-10-30 08:18:26 +08:00
Handle selects and memsets in alloca tracking
Handle selects and memsets in alloca tracking
This commit is contained in:
@ -401,6 +401,12 @@ static bool tryFindPointerOrigin(GetElementPtrInst *Ptr, SmallVectorImpl<Instruc
|
|||||||
return tryFindPointerOriginImpl(Ptr->getPointerOperand(), origins, cache);
|
return tryFindPointerOriginImpl(Ptr->getPointerOperand(), origins, cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool tryFindPointerOrigin(SelectInst *Ptr, SmallVectorImpl<Instruction *> &origins,
|
||||||
|
DenseSet<Value *> &cache) {
|
||||||
|
return tryFindPointerOriginImpl(Ptr->getTrueValue(), origins, cache) &&
|
||||||
|
tryFindPointerOriginImpl(Ptr->getFalseValue(), origins, cache);
|
||||||
|
}
|
||||||
|
|
||||||
static bool tryFindPointerOriginImpl(Value *ptr, SmallVectorImpl<Instruction *> &origins, DenseSet<Value *> &cache) {
|
static bool tryFindPointerOriginImpl(Value *ptr, SmallVectorImpl<Instruction *> &origins, DenseSet<Value *> &cache) {
|
||||||
if (!cache.insert(ptr).second)
|
if (!cache.insert(ptr).second)
|
||||||
return true;
|
return true;
|
||||||
@ -409,6 +415,10 @@ static bool tryFindPointerOriginImpl(Value *ptr, SmallVectorImpl<Instruction *>
|
|||||||
return tryFindPointerOrigin(GEP, origins, cache);
|
return tryFindPointerOrigin(GEP, origins, cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (auto *select = dyn_cast<SelectInst>(ptr)) {
|
||||||
|
return tryFindPointerOrigin(select, origins, cache);
|
||||||
|
}
|
||||||
|
|
||||||
if (auto *allocaI = dyn_cast<AllocaInst>(ptr)) {
|
if (auto *allocaI = dyn_cast<AllocaInst>(ptr)) {
|
||||||
origins.push_back(allocaI);
|
origins.push_back(allocaI);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user