From 1970568ab31879094666b20d6f09b39682c20864 Mon Sep 17 00:00:00 2001 From: Thurston Dang Date: Wed, 17 Jul 2024 19:20:29 +0000 Subject: [PATCH] Revert setOriginForNaryOp --- .../Instrumentation/MemorySanitizer.cpp | 24 ++++++------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp index 67b263fb0e4980..3652b4561f8b66 100644 --- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp @@ -2505,21 +2505,13 @@ struct MemorySanitizerVisitor : public InstVisitor { using OriginCombiner = Combiner; /// Propagate origin for arbitrary operation. - /// - /// Optionally skips n trailing operands. - void setOriginForNaryOp(Instruction &I, unsigned int skipLastOperands = 0) { + void setOriginForNaryOp(Instruction &I) { if (!MS.TrackOrigins) return; IRBuilder<> IRB(&I); OriginCombiner OC(this, IRB); - - if (skipLastOperands > 0) - assert((I.getNumOperands() > skipLastOperands) && - "Insufficient number of operands to skip!"); - - for (unsigned int i = 0; i < I.getNumOperands() - skipLastOperands; i++) - OC.Add(I.getOperand(i)); - + for (Use &Op : I.operands()) + OC.Add(Op.get()); OC.Done(&I); } @@ -3983,12 +3975,10 @@ struct MemorySanitizerVisitor : public InstVisitor { IRB.CreateAlignedStore(interleavedShadow, ShadowPtr, Align(1)); if (MS.TrackOrigins) { - // We don't use the last two operands to compute the origin, because: - // - the last operand is the callee - // e.g., 'declare void @llvm.aarch64.neon.st2.v8i16.p0(...' - // - the second-last operand is the return value - // e.g., '%arraydecay74 = getelementptr inbounds ...' - setOriginForNaryOp(I, 2); + OriginCombiner OC(this, IRB); + for (int i = 0; i < numArgOperands - 1; i++) + OC.Add(I.getOperand(i)); + OC.Done(&I); } if (ClCheckAccessAddress)