@@ -2635,14 +2635,16 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
2635
2635
// We copy the shadow of \p CopyOp[NumUsedElements:] to \p
2636
2636
// Out[NumUsedElements:]. This means that intrinsics without \p CopyOp always
2637
2637
// return a fully initialized value.
2638
- void handleVectorConvertIntrinsic (IntrinsicInst &I, int NumUsedElements) {
2638
+ void handleVectorConvertIntrinsic (IntrinsicInst &I, int NumUsedElements,
2639
+ bool HasRoundingMode = false ) {
2639
2640
IRBuilder<> IRB (&I);
2640
2641
Value *CopyOp, *ConvertOp;
2641
2642
2642
- switch (I.getNumArgOperands ()) {
2643
- case 3 :
2644
- assert (isa<ConstantInt>(I.getArgOperand (2 )) && " Invalid rounding mode" );
2645
- LLVM_FALLTHROUGH;
2643
+ assert ((!HasRoundingMode ||
2644
+ isa<ConstantInt>(I.getArgOperand (I.getNumArgOperands () - 1 ))) &&
2645
+ " Invalid rounding mode" );
2646
+
2647
+ switch (I.getNumArgOperands () - HasRoundingMode) {
2646
2648
case 2 :
2647
2649
CopyOp = I.getArgOperand (0 );
2648
2650
ConvertOp = I.getArgOperand (1 );
@@ -3179,6 +3181,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
3179
3181
case Intrinsic::x86_avx512_cvtusi2ss:
3180
3182
case Intrinsic::x86_avx512_cvtusi642sd:
3181
3183
case Intrinsic::x86_avx512_cvtusi642ss:
3184
+ handleVectorConvertIntrinsic (I, 1 , true );
3185
+ break ;
3182
3186
case Intrinsic::x86_sse2_cvtsd2si64:
3183
3187
case Intrinsic::x86_sse2_cvtsd2si:
3184
3188
case Intrinsic::x86_sse2_cvtsd2ss:
0 commit comments