Skip to content

Commit 0b41238

Browse files
committed
[AArch64] Emit TBAA metadata for SVE load/store intrinsics
In Clang we can attach TBAA metadata based on the load/store intrinsics based on the operation's element type. This also contains changes to InstCombine where the AArch64-specific intrinsics are transformed into generic LLVM load/store operations, to ensure that all metadata is transferred to the new instruction. There will be some further work after this patch to also emit TBAA metadata for SVE's gather/scatter- and struct load/store intrinsics. Reviewed By: paulwalker-arm Differential Revision: https://reviews.llvm.org/D119319
1 parent b055e6d commit 0b41238

File tree

4 files changed

+71
-43
lines changed

4 files changed

+71
-43
lines changed

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9028,7 +9028,10 @@ Value *CodeGenFunction::EmitSVEMaskedLoad(const CallExpr *E,
90289028

90299029
BasePtr = Builder.CreateBitCast(BasePtr, MemEltTy->getPointerTo());
90309030
Function *F = CGM.getIntrinsic(BuiltinID, MemoryTy);
9031-
Value *Load = Builder.CreateCall(F, {Predicate, BasePtr});
9031+
auto *Load =
9032+
cast<llvm::Instruction>(Builder.CreateCall(F, {Predicate, BasePtr}));
9033+
auto TBAAInfo = CGM.getTBAAAccessInfo(LangPTy->getPointeeType());
9034+
CGM.DecorateInstructionWithTBAA(Load, TBAAInfo);
90329035

90339036
return IsZExtReturn ? Builder.CreateZExt(Load, VectorTy)
90349037
: Builder.CreateSExt(Load, VectorTy);
@@ -9056,7 +9059,11 @@ Value *CodeGenFunction::EmitSVEMaskedStore(const CallExpr *E,
90569059

90579060
BasePtr = Builder.CreateBitCast(BasePtr, MemEltTy->getPointerTo());
90589061
Function *F = CGM.getIntrinsic(BuiltinID, MemoryTy);
9059-
return Builder.CreateCall(F, {Val, Predicate, BasePtr});
9062+
auto *Store =
9063+
cast<llvm::Instruction>(Builder.CreateCall(F, {Val, Predicate, BasePtr}));
9064+
auto TBAAInfo = CGM.getTBAAAccessInfo(LangPTy->getPointeeType());
9065+
CGM.DecorateInstructionWithTBAA(Store, TBAAInfo);
9066+
return Store;
90609067
}
90619068

90629069
// Limit the usage of scalable llvm IR generated by the ACLE by using the

0 commit comments

Comments
 (0)