Skip to content

Commit

Permalink
Use arg_size() instead of (getNumOperands() - 1)
Browse files Browse the repository at this point in the history
  • Loading branch information
thurstond committed Jul 17, 2024
1 parent cad5cf0 commit f3aa040
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3800,10 +3800,11 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
/// Calculates the shadow for interleaving 2, 3 or 4 vectors
/// (e.g., for Arm NEON vector store).
Value *interleaveShadow(IRBuilder<> &IRB, IntrinsicInst &I) {
// Call arguments only
int numArgOperands = I.getNumOperands() - 1;
// Don't use getNumOperands() because it includes the callee
int numArgOperands = I.arg_size();
assert(numArgOperands >= 1);

// The last arg operand is the output
int numVectors = numArgOperands - 1;

for (int i = 0; i < numVectors; i++) {
Expand Down Expand Up @@ -3846,9 +3847,11 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {

Value *interleavedShadow = interleaveShadow(IRB, I);

// Call arguments only
int numArgOperands = I.getNumOperands() - 1;
// Don't use getNumOperands() because it includes the callee
int numArgOperands = I.arg_size();
assert(numArgOperands >= 1);

// The last arg operand is the output
Value *Addr = I.getArgOperand(numArgOperands - 1);

Value *ShadowPtr, *OriginPtr;
Expand Down

0 comments on commit f3aa040

Please sign in to comment.