@@ -3684,6 +3684,10 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
3684
3684
// TODO: Store origin.
3685
3685
}
3686
3686
3687
+ // Intrinsic::masked_store
3688
+ //
3689
+ // Note: handleAVXMaskedStore handles AVX/AVX2 variants, though AVX512 masked
3690
+ // stores are lowered to Intrinsic::masked_store.
3687
3691
void handleMaskedStore (IntrinsicInst &I) {
3688
3692
IRBuilder<> IRB (&I);
3689
3693
Value *V = I.getArgOperand (0 );
@@ -3714,6 +3718,10 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
3714
3718
std::max (Alignment, kMinOriginAlignment ));
3715
3719
}
3716
3720
3721
+ // Intrinsic::masked_load
3722
+ //
3723
+ // Note: handleAVXMaskedLoad handles AVX/AVX2 variants, though AVX512 masked
3724
+ // loads are lowered to Intrinsic::masked_load.
3717
3725
void handleMaskedLoad (IntrinsicInst &I) {
3718
3726
IRBuilder<> IRB (&I);
3719
3727
Value *Ptr = I.getArgOperand (0 );
@@ -3758,13 +3766,16 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
3758
3766
// e.g., void @llvm.x86.avx.maskstore.ps.256(ptr, <8 x i32>, <8 x float>)
3759
3767
// dst mask src
3760
3768
//
3761
- // Note: it is difficult to combine this function with handleMaskedStore. The
3762
- // key challenge is that the LLVM masked intrinsics require a vector of
3763
- // booleans, while AVX masked intrinsics use the MSBs of a vector of
3764
- // integers. X86InstCombineIntrinsic.cpp::simplifyX86MaskedLoad mentions that
3765
- // the x86 backend does not know how to efficiently convert from a vector of
3766
- // booleans back into the AVX mask format; therefore, they (and we) do not
3767
- // reduce AVX masked intrinsics into LLVM masked intrinsics.
3769
+ // AVX512 masked stores are lowered to Intrinsic::masked_load and are handled
3770
+ // by handleMaskedStore.
3771
+ //
3772
+ // This function handles AVX and AVX2 masked stores; these use the MSBs of a
3773
+ // vector of integers, unlike the LLVM masked intrinsics, which require a
3774
+ // vector of booleans. X86InstCombineIntrinsic.cpp::simplifyX86MaskedLoad
3775
+ // mentions that the x86 backend does not know how to efficiently convert
3776
+ // from a vector of booleans back into the AVX mask format; therefore, they
3777
+ // (and we) do not reduce AVX/AVX2 masked intrinsics into LLVM masked
3778
+ // intrinsics.
3768
3779
void handleAVXMaskedStore (IntrinsicInst &I) {
3769
3780
IRBuilder<> IRB (&I);
3770
3781
@@ -3820,6 +3831,9 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
3820
3831
// Masked-off values are replaced with 0, which conveniently also represents
3821
3832
// initialized memory.
3822
3833
//
3834
+ // AVX512 masked stores are lowered to Intrinsic::masked_load and are handled
3835
+ // by handleMaskedStore.
3836
+ //
3823
3837
// We do not combine this with handleMaskedLoad; see comment in
3824
3838
// handleAVXMaskedStore for the rationale.
3825
3839
//
0 commit comments