Skip to content

Commit 61fdc3d

Browse files
committed
Fix aspects detection of AllocaInst when opaque pointers are enabled
1 parent ed7cb4b commit 61fdc3d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

llvm/lib/SYCLLowerIR/SYCLPropagateAspectsUsage.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,12 @@ const AspectsSetTy &getAspectsFromType(const Type *T,
191191
AspectsSetTy getAspectsUsedByInstruction(const Instruction &I,
192192
TypeToAspectsMapTy &Types) {
193193
const Type *ReturnType = I.getType();
194+
if (auto *AI = dyn_cast<const AllocaInst>(&I)) {
195+
// Return type of an alloca is a pointer and in opaque pointers world we
196+
// don't know which type it points to. Therefore, explicitly checking the
197+
// allocated type insted
198+
ReturnType = AI->getAllocatedType();
199+
}
194200
AspectsSetTy Result = getAspectsFromType(ReturnType, Types);
195201
for (const auto &OperandIt : I.operands()) {
196202
const AspectsSetTy &Aspects =

0 commit comments

Comments
 (0)