Skip to content

Commit 3a09dcb

Browse files
committed
Address Florian1 feedback
1 parent 7565480 commit 3a09dcb

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4074,9 +4074,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
40744074
CallInst *CI =
40754075
IRB.CreateIntrinsic(I.getType(), I.getIntrinsicID(), ShadowArgs);
40764076
// The AVX masked load intrinsics do not have integer variants. We use the
4077-
// floating-point variants, and assume that the intrinsic will happily copy
4078-
// the shadows even if they are interpreted as "invalid" floating-point
4079-
// values (NaN etc.).
4077+
// floating-point variants, which will happily copy the shadows even if
4078+
// they are interpreted as "invalid" floating-point values (NaN etc.).
40804079
setShadow(&I, IRB.CreateBitCast(CI, getShadowTy(&I)));
40814080

40824081
if (!MS.TrackOrigins)
@@ -4260,23 +4259,22 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
42604259
assert(I.getType()->isStructTy());
42614260
[[maybe_unused]] StructType *RetTy = cast<StructType>(I.getType());
42624261
assert(RetTy->getNumElements() > 0);
4263-
assert(isa<FixedVectorType>(RetTy->getElementType(0)));
42644262
assert(RetTy->getElementType(0)->isIntOrIntVectorTy() ||
42654263
RetTy->getElementType(0)->isFPOrFPVectorTy());
42664264
for (unsigned int i = 0; i < RetTy->getNumElements(); i++)
42674265
assert(RetTy->getElementType(i) == RetTy->getElementType(0));
42684266

42694267
if (WithLane) {
42704268
// 2, 3 or 4 vectors, plus lane number, plus input pointer
4271-
assert(numArgs >= 4);
4272-
assert(numArgs <= 6);
4269+
assert(4 <= numArgs && numArgs <= 6);
42734270

42744271
// Return type is a struct of the input vectors
42754272
assert(RetTy->getNumElements() + 2 == numArgs);
42764273
for (unsigned int i = 0; i < RetTy->getNumElements(); i++)
42774274
assert(I.getArgOperand(i)->getType() == RetTy->getElementType(0));
4278-
} else
4275+
} else {
42794276
assert(numArgs == 1);
4277+
}
42804278

42814279
IRBuilder<> IRB(&I);
42824280

@@ -4299,16 +4297,14 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
42994297
const Align Alignment = Align(1);
43004298

43014299
Type *SrcShadowTy = getShadowTy(Src);
4302-
Value *SrcShadowPtr, *SrcOriginPtr;
4303-
std::tie(SrcShadowPtr, SrcOriginPtr) =
4300+
auto [SrcShadowPtr, SrcOriginPtr] =
43044301
getShadowOriginPtr(Src, IRB, SrcShadowTy, Alignment, /*isStore*/ false);
43054302
ShadowArgs.push_back(SrcShadowPtr);
43064303

4307-
CallInst *CI;
43084304
// The NEON vector load instructions handled by this function all have
43094305
// integer variants. It is easier to use those rather than trying to cast
43104306
// a struct of vectors of floats into a struct of vectors of integers.
4311-
CI = IRB.CreateIntrinsic(getShadowTy(&I), I.getIntrinsicID(), ShadowArgs);
4307+
CallInst *CI = IRB.CreateIntrinsic(getShadowTy(&I), I.getIntrinsicID(), ShadowArgs);
43124308
setShadow(&I, CI);
43134309

43144310
if (!MS.TrackOrigins)

0 commit comments

Comments
 (0)