-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[NFC] [MSAN] disambiguate insertShadowCheck #146616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NFC] [MSAN] disambiguate insertShadowCheck #146616
Conversation
Created using spr 1.3.4
|
@llvm/pr-subscribers-compiler-rt-sanitizer @llvm/pr-subscribers-llvm-transforms Author: Florian Mayer (fmayer) ChangesOne of them operates on values, the other on shadows. It is confusing Full diff: https://github.com/llvm/llvm-project/pull/146616.diff 1 Files Affected:
diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
index ca655b3597671..abb03765226cf 100644
--- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -2182,7 +2182,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
///
/// This location will be later instrumented with a check that will print a
/// UMR warning in runtime if the shadow value is not 0.
- void insertShadowCheck(Value *Shadow, Value *Origin, Instruction *OrigIns) {
+ void insertCheckShadow(Value *Shadow, Value *Origin, Instruction *OrigIns) {
assert(Shadow);
if (!InsertChecks)
return;
@@ -2203,7 +2203,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
ShadowOriginAndInsertPoint(Shadow, Origin, OrigIns));
}
- /// Remember the place where a shadow check should be inserted.
+ /// Get shadow for value, and remember the place where a shadow check should
+ /// be inserted.
///
/// This location will be later instrumented with a check that will print a
/// UMR warning in runtime if the value is not fully defined.
@@ -2221,7 +2222,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
return;
Origin = dyn_cast_or_null<Instruction>(getOrigin(Val));
}
- insertShadowCheck(Shadow, Origin, OrigIns);
+ insertCheckShadow(Shadow, Origin, OrigIns);
}
AtomicOrdering addReleaseOrdering(AtomicOrdering a) {
@@ -3516,7 +3517,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
AggShadow = ConvertShadow;
}
assert(AggShadow->getType()->isIntegerTy());
- insertShadowCheck(AggShadow, getOrigin(ConvertOp), &I);
+ insertCheckShadow(AggShadow, getOrigin(ConvertOp), &I);
// Build result shadow by zero-filling parts of CopyOp shadow that come from
// ConvertOp.
@@ -3944,7 +3945,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
Value *Shadow = IRB.CreateAlignedLoad(Ty, ShadowPtr, Alignment, "_ldmxcsr");
Value *Origin = MS.TrackOrigins ? IRB.CreateLoad(MS.OriginTy, OriginPtr)
: getCleanOrigin();
- insertShadowCheck(Shadow, Origin, &I);
+ insertCheckShadow(Shadow, Origin, &I);
}
void handleMaskedExpandLoad(IntrinsicInst &I) {
@@ -4017,7 +4018,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
Value *MaskedPtrShadow = IRB.CreateSelect(
Mask, getShadow(Ptrs), Constant::getNullValue((PtrsShadowTy)),
"_msmaskedptrs");
- insertShadowCheck(MaskedPtrShadow, getOrigin(Ptrs), &I);
+ insertCheckShadow(MaskedPtrShadow, getOrigin(Ptrs), &I);
}
if (!PropagateShadow) {
@@ -4055,7 +4056,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
Value *MaskedPtrShadow = IRB.CreateSelect(
Mask, getShadow(Ptrs), Constant::getNullValue((PtrsShadowTy)),
"_msmaskedptrs");
- insertShadowCheck(MaskedPtrShadow, getOrigin(Ptrs), &I);
+ insertCheckShadow(MaskedPtrShadow, getOrigin(Ptrs), &I);
}
Value *Shadow = getShadow(Values);
|
|
IMO the new names ( Maybe something like insertCheckShadowOf(X)? |
SGTM |
thurstond
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but I'd also welcome @vitalybuka's feedback since he probably has to stare at MSan code a lot too :-)
One of them operates on values, the other on shadows. It is confusing
for both of them to have the same name but only different number of
parameters.