From 61fdc3de1db3dcb02e287eee5255efc47057df3b Mon Sep 17 00:00:00 2001 From: Alexey Sachkov Date: Tue, 13 Sep 2022 08:22:11 -0400 Subject: [PATCH 1/2] Fix aspects detection of AllocaInst when opaque pointers are enabled --- llvm/lib/SYCLLowerIR/SYCLPropagateAspectsUsage.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/llvm/lib/SYCLLowerIR/SYCLPropagateAspectsUsage.cpp b/llvm/lib/SYCLLowerIR/SYCLPropagateAspectsUsage.cpp index 629cad79a1b9a..7151cfe02b203 100644 --- a/llvm/lib/SYCLLowerIR/SYCLPropagateAspectsUsage.cpp +++ b/llvm/lib/SYCLLowerIR/SYCLPropagateAspectsUsage.cpp @@ -191,6 +191,12 @@ const AspectsSetTy &getAspectsFromType(const Type *T, AspectsSetTy getAspectsUsedByInstruction(const Instruction &I, TypeToAspectsMapTy &Types) { const Type *ReturnType = I.getType(); + if (auto *AI = dyn_cast(&I)) { + // Return type of an alloca is a pointer and in opaque pointers world we + // don't know which type it points to. Therefore, explicitly checking the + // allocated type insted + ReturnType = AI->getAllocatedType(); + } AspectsSetTy Result = getAspectsFromType(ReturnType, Types); for (const auto &OperandIt : I.operands()) { const AspectsSetTy &Aspects = From 477a07e42af1254d21d474a1bca224193a90c97f Mon Sep 17 00:00:00 2001 From: Alexey Sachkov Date: Tue, 20 Sep 2022 10:54:41 -0400 Subject: [PATCH 2/2] Fix typo --- llvm/lib/SYCLLowerIR/SYCLPropagateAspectsUsage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/SYCLLowerIR/SYCLPropagateAspectsUsage.cpp b/llvm/lib/SYCLLowerIR/SYCLPropagateAspectsUsage.cpp index 7151cfe02b203..e3b7eaa984e15 100644 --- a/llvm/lib/SYCLLowerIR/SYCLPropagateAspectsUsage.cpp +++ b/llvm/lib/SYCLLowerIR/SYCLPropagateAspectsUsage.cpp @@ -194,7 +194,7 @@ AspectsSetTy getAspectsUsedByInstruction(const Instruction &I, if (auto *AI = dyn_cast(&I)) { // Return type of an alloca is a pointer and in opaque pointers world we // don't know which type it points to. Therefore, explicitly checking the - // allocated type insted + // allocated type instead ReturnType = AI->getAllocatedType(); } AspectsSetTy Result = getAspectsFromType(ReturnType, Types);