[llvm-branch-commits] [NFC][msan] Prepare function to extract main logic (PR #94880)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sat Jun 8 19:22:12 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: Vitaly Buka (vitalybuka)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/94880.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp (+6-4)
``````````diff
diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
index 43b2dee4572a9..d312b0107932b 100644
--- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -4562,10 +4562,15 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
Value *B = I.getCondition();
Value *C = I.getTrueValue();
Value *D = I.getFalseValue();
+
Value *Sb = getShadow(B);
Value *Sc = getShadow(C);
Value *Sd = getShadow(D);
+ Value *Ob = MS.TrackOrigins ? getOrigin(B) : nullptr;
+ Value *Oc = MS.TrackOrigins ? getOrigin(C) : nullptr;
+ Value *Od = MS.TrackOrigins ? getOrigin(D) : nullptr;
+
// Result shadow if condition shadow is 0.
Value *Sa0 = IRB.CreateSelect(B, Sc, Sd);
Value *Sa1;
@@ -4598,10 +4603,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
}
// a = select b, c, d
// Oa = Sb ? Ob : (b ? Oc : Od)
- setOrigin(
- &I, IRB.CreateSelect(Sb, getOrigin(I.getCondition()),
- IRB.CreateSelect(B, getOrigin(I.getTrueValue()),
- getOrigin(I.getFalseValue()))));
+ setOrigin(&I, IRB.CreateSelect(Sb, Ob, IRB.CreateSelect(B, Oc, Od)));
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/94880
More information about the llvm-branch-commits
mailing list