@@ -2635,14 +2635,16 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
26352635 // We copy the shadow of \p CopyOp[NumUsedElements:] to \p
26362636 // Out[NumUsedElements:]. This means that intrinsics without \p CopyOp always
26372637 // return a fully initialized value.
2638- void handleVectorConvertIntrinsic (IntrinsicInst &I, int NumUsedElements) {
2638+ void handleVectorConvertIntrinsic (IntrinsicInst &I, int NumUsedElements,
2639+ bool HasRoundingMode = false ) {
26392640 IRBuilder<> IRB (&I);
26402641 Value *CopyOp, *ConvertOp;
26412642
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) {
26462648 case 2 :
26472649 CopyOp = I.getArgOperand (0 );
26482650 ConvertOp = I.getArgOperand (1 );
@@ -3179,6 +3181,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
31793181 case Intrinsic::x86_avx512_cvtusi2ss:
31803182 case Intrinsic::x86_avx512_cvtusi642sd:
31813183 case Intrinsic::x86_avx512_cvtusi642ss:
3184+ handleVectorConvertIntrinsic (I, 1 , true );
3185+ break ;
31823186 case Intrinsic::x86_sse2_cvtsd2si64:
31833187 case Intrinsic::x86_sse2_cvtsd2si:
31843188 case Intrinsic::x86_sse2_cvtsd2ss:
0 commit comments