[PATCH] D131845: [MSAN] Correct shadow type for atomicrmw instrumentation

Keno Fischer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 23 20:35:50 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG5739d29cde07: [MSAN] Correct shadow type for atomicrmw instrumentation (authored by loladiro).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131845/new/

https://reviews.llvm.org/D131845

Files:
  llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
  llvm/test/Instrumentation/MemorySanitizer/atomics.ll


Index: llvm/test/Instrumentation/MemorySanitizer/atomics.ll
===================================================================
--- llvm/test/Instrumentation/MemorySanitizer/atomics.ll
+++ llvm/test/Instrumentation/MemorySanitizer/atomics.ll
@@ -22,6 +22,20 @@
 ; CHECK: store i32 0, {{.*}} @__msan_retval_tls
 ; CHECK: ret i32
 
+; atomicrmw xchg ptr: exactly the same as above
+
+define i32* @AtomicRmwXchgPtr(i32** %p, i32* %x) sanitize_memory {
+entry:
+  %0 = atomicrmw xchg i32** %p, i32* %x seq_cst
+  ret i32* %0
+}
+
+; CHECK-LABEL: @AtomicRmwXchgPtr
+; CHECK: store i64 0,
+; CHECK: atomicrmw xchg {{.*}} seq_cst
+; CHECK: store i64 0, {{.*}} @__msan_retval_tls
+; CHECK: ret i32*
+
 
 ; atomicrmw max: exactly the same as above
 
Index: llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -1949,7 +1949,7 @@
     IRBuilder<> IRB(&I);
     Value *Addr = I.getOperand(0);
     Value *Val = I.getOperand(1);
-    Value *ShadowPtr = getShadowOriginPtr(Addr, IRB, Val->getType(), Align(1),
+    Value *ShadowPtr = getShadowOriginPtr(Addr, IRB, getShadowTy(Val), Align(1),
                                           /*isStore*/ true)
                            .first;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131845.455060.patch
Type: text/x-patch
Size: 1372 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220824/42204ae8/attachment.bin>


More information about the llvm-commits mailing list