aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorAndrew Lazarev <alazarev@google.com>2026-02-09 16:23:52 -0800
committerGitHub <noreply@github.com>2026-02-09 19:23:52 -0500
commitcfbb9a66ae92aa477c6ea38b006d64ec4b92170d (patch)
treeff19cec0eeae7845779fcf5c36b0004f4c42e17c /llvm/lib/Transforms
parent481f248e081bd82b7a26a0b9b7ce8613544cc1a6 (diff)
downloadllvm-cfbb9a66ae92aa477c6ea38b006d64ec4b92170d.tar.gz
llvm-cfbb9a66ae92aa477c6ea38b006d64ec4b92170d.tar.bz2
llvm-cfbb9a66ae92aa477c6ea38b006d64ec4b92170d.zip
Revert "[msan] Switch switch() from strict handling to (icmp eq)-style handling" (#180636)
Reverts llvm/llvm-project#179851 Breaks https://lab.llvm.org/buildbot/#/builders/164/builds/18551 and https://lab.llvm.org/buildbot/#/builders/94/builds/15188
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp41
1 files changed, 0 insertions, 41 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
index 3e7eafd756e8..5e766d8e0ff8 100644
--- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -2460,47 +2460,6 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
return Si;
}
- // Instrument:
- // switch i32 %Val, label %else [ i32 0, label %A
- // i32 1, label %B
- // i32 2, label %C ]
- //
- // Typically, the switch input value (%Val) is fully initialized.
- //
- // Sometimes the compiler may convert (icmp + br) into a switch statement.
- // MSan allows icmp eq/ne with partly initialized inputs to still result in a
- // fully initialized output, if there exists a bit that is initialized in
- // both inputs with a differing value. For compatibility, we support this in
- // the switch instrumentation as well. Note that this edge case only applies
- // if the switch input value does not match *any* of the cases (matching any
- // of the cases requires an exact, fully initialized match).
- //
- // ShadowCases = 0
- // | propagateEqualityComparison(Val, 0)
- // | propagateEqualityComparison(Val, 1)
- // | propagateEqualityComparison(Val, 2))
- void visitSwitchInst(SwitchInst &SI) {
- IRBuilder<> IRB(&SI);
-
- Value *Val = SI.getCondition();
- Value *ShadowVal = getShadow(Val);
-
- Value *ShadowCases = nullptr;
- for (auto Case : SI.cases()) {
- Value *Comparator = Case.getCaseValue();
- Value *ComparisonShadow = propagateEqualityComparison(
- IRB, Val, Comparator, ShadowVal, getShadow(Comparator));
-
- if (ShadowCases)
- ShadowCases = IRB.CreateOr(ShadowCases, ComparisonShadow);
- else
- ShadowCases = ComparisonShadow;
- }
-
- if (ShadowCases)
- insertCheckShadow(ShadowCases, getOrigin(Val), &SI);
- }
-
// Vector manipulation.
void visitExtractElementInst(ExtractElementInst &I) {
insertCheckShadowOf(I.getOperand(1), &I);