[PATCH] D97029: [msan] Set cmpxchg shadow precisely
Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 19 12:24:05 PST 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGefc8f3311b57: [msan] Set cmpxchg shadow precisely (authored by Jianzhou Zhao <jianzhouzh at google.com>).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97029/new/
https://reviews.llvm.org/D97029
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
@@ -51,7 +51,7 @@
}
; CHECK-LABEL: @Cmpxchg
-; CHECK: store { i32, i1 } zeroinitializer,
+; CHECK: store i32 0,
; CHECK: icmp
; CHECK: br
; CHECK: @__msan_warning_with_origin
@@ -70,7 +70,7 @@
}
; CHECK-LABEL: @CmpxchgMonotonic
-; CHECK: store { i32, i1 } zeroinitializer,
+; CHECK: store i32 0,
; CHECK: icmp
; CHECK: br
; CHECK: @__msan_warning_with_origin
Index: llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -1948,7 +1948,8 @@
IRBuilder<> IRB(&I);
Value *Addr = I.getOperand(0);
- Value *ShadowPtr = getShadowOriginPtr(Addr, IRB, I.getType(), Align(1),
+ Value *Val = I.getOperand(1);
+ Value *ShadowPtr = getShadowOriginPtr(Addr, IRB, Val->getType(), Align(1),
/*isStore*/ true)
.first;
@@ -1959,9 +1960,9 @@
// The other argument can potentially be uninitialized, but we can not
// detect this situation reliably without possible false positives.
if (isa<AtomicCmpXchgInst>(I))
- insertShadowCheck(I.getOperand(1), &I);
+ insertShadowCheck(Val, &I);
- IRB.CreateStore(getCleanShadow(&I), ShadowPtr);
+ IRB.CreateStore(getCleanShadow(Val), ShadowPtr);
setShadow(&I, getCleanShadow(&I));
setOrigin(&I, getCleanOrigin());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97029.325061.patch
Type: text/x-patch
Size: 1721 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210219/83f5e921/attachment.bin>
More information about the llvm-commits
mailing list