[Openmp-commits] [openmp] [compiler-rt] [llvm] [TSan] Add instrumentation of AVX2 and AVX512 instructions (PR #74636)
Vitaly Buka via Openmp-commits
openmp-commits at lists.llvm.org
Mon Dec 11 23:48:28 PST 2023
================
@@ -506,30 +530,40 @@ bool ThreadSanitizer::sanitizeFunction(Function &F,
initialize(*F.getParent(), TLI);
SmallVector<InstructionInfo, 8> AllLoadsAndStores;
- SmallVector<Instruction*, 8> LocalLoadsAndStores;
- SmallVector<Instruction*, 8> AtomicAccesses;
- SmallVector<Instruction*, 8> MemIntrinCalls;
+ SmallVector<Instruction *, 8> LocalLoadsAndStores;
+ SmallVector<Instruction *, 8> AtomicAccesses;
+ SmallVector<Instruction *, 8> MemIntrinCalls;
+ SmallVector<Instruction *, 8> AllGathersAndScatters;
+
bool Res = false;
bool HasCalls = false;
bool SanitizeFunction = F.hasFnAttribute(Attribute::SanitizeThread);
const DataLayout &DL = F.getParent()->getDataLayout();
- // Traverse all instructions, collect loads/stores/returns, check for calls.
+ // Traverse all instructions, collect loads/stores/returns/gathers/scatters,
+ // check for calls.
for (auto &BB : F) {
for (auto &Inst : BB) {
// Skip instructions inserted by another instrumentation.
if (Inst.hasMetadata(LLVMContext::MD_nosanitize))
continue;
- if (isTsanAtomic(&Inst))
+ if (isTsanAtomic(&Inst)) {
AtomicAccesses.push_back(&Inst);
- else if (isa<LoadInst>(Inst) || isa<StoreInst>(Inst))
+ } else if (isa<LoadInst>(Inst) || isa<StoreInst>(Inst)) {
LocalLoadsAndStores.push_back(&Inst);
- else if ((isa<CallInst>(Inst) && !isa<DbgInfoIntrinsic>(Inst)) ||
- isa<InvokeInst>(Inst)) {
- if (CallInst *CI = dyn_cast<CallInst>(&Inst))
+ } else if ((isa<CallInst>(Inst) && !isa<DbgInfoIntrinsic>(Inst)) ||
+ isa<InvokeInst>(Inst)) {
+ if (CallInst *CI = dyn_cast<CallInst>(&Inst)) {
+ auto CFunc = CI->getCalledFunction();
+ if (CFunc && (CFunc->getName().contains("llvm.masked.scatter") ||
----------------
vitalybuka wrote:
That's not how intrinsic suppose to be checked.
```
if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(Inst)) {
switch (II->getIntrinsicID()) {
case Intrinsic::masked_scatter:
```
https://github.com/llvm/llvm-project/pull/74636
More information about the Openmp-commits
mailing list