@@ -4050,7 +4050,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
40504050 // To make shadow propagation precise, we want the equivalent of
40514051 // "horizontal OR", but this is not available.
40524052 return handleIntrinsicByApplyingToShadow (
4053- I, /* trailingVerbatimArgs*/ 0 , /* shadowIntrinsicID=*/ std::nullopt );
4053+ I, /* shadowIntrinsicID=*/ I.getIntrinsicID (),
4054+ /* trailingVerbatimArgs*/ 0 );
40544055 }
40554056
40564057 // / Handle Arm NEON vector store intrinsics (vst{2,3,4}, vst1x_{2,3,4},
@@ -4157,7 +4158,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
41574158 // / shadow[out] =
41584159 // / intrinsic(shadow[var1], shadow[var2], opType) | shadow[opType]
41594160 // /
4160- // / Optionally, the intrinsic for the shadow can be replaced with another
4161+ // / Typically, shadowIntrinsicID will be specified by the caller to be
4162+ // / I.getIntrinsicID(), but the caller can choose to replace it with another
41614163 // / intrinsic of the same type.
41624164 // /
41634165 // / CAUTION: this assumes that the intrinsic will handle arbitrary
@@ -4168,9 +4170,9 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
41684170 // / (tbl{1,2,3,4}).
41694171 // /
41704172 // / The origin is approximated using setOriginForNaryOp.
4171- void handleIntrinsicByApplyingToShadow (
4172- IntrinsicInst &I, unsigned int trailingVerbatimArgs ,
4173- std::optional<Intrinsic::ID> shadowIntrinsicID ) {
4173+ void handleIntrinsicByApplyingToShadow (IntrinsicInst &I,
4174+ Intrinsic::ID shadowIntrinsicID ,
4175+ unsigned int trailingVerbatimArgs ) {
41744176 IRBuilder<> IRB (&I);
41754177
41764178 assert (trailingVerbatimArgs < I.arg_size ());
@@ -4192,9 +4194,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
41924194 ShadowArgs.push_back (Arg);
41934195 }
41944196
4195- CallInst *CI = IRB.CreateIntrinsic (
4196- I.getType (), shadowIntrinsicID.value_or (I.getIntrinsicID ()),
4197- ShadowArgs);
4197+ CallInst *CI =
4198+ IRB.CreateIntrinsic (I.getType (), shadowIntrinsicID, ShadowArgs);
41984199 Value *CombinedShadow = CI;
41994200
42004201 // Combine the computed shadow with the shadow of trailing args
@@ -4670,8 +4671,9 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
46704671 case Intrinsic::aarch64_neon_tbx3:
46714672 case Intrinsic::aarch64_neon_tbx4: {
46724673 // The last trailing argument (index register) should be handled verbatim
4673- handleIntrinsicByApplyingToShadow (I, /* trailingVerbatimArgs*/ 1 ,
4674- /* shadowIntrinsicID=*/ std::nullopt );
4674+ handleIntrinsicByApplyingToShadow (
4675+ I, /* shadowIntrinsicID=*/ I.getIntrinsicID (),
4676+ /* trailingVerbatimArgs*/ 1 );
46754677 break ;
46764678 }
46774679
0 commit comments