From 74cc0fa1db74d678436020a64a8ca0e9e99954d1 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Fri, 3 Dec 2021 16:53:47 +0000 Subject: [PATCH] [IR][AutoUpgrade] Merge x86 mask load intrinsic upgrades. NFC. Helps appease MSVC which is complaining about "fatal error C1061: compiler limit: blocks nested too deeply" - we already do the same thing for avx512.mask.store intrinsics. This is only a stopgap solution until another else-if case needs adding - we really need to refactor this chain of ifs properly. --- llvm/lib/IR/AutoUpgrade.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp index 2216cfe..b8ad2b2 100644 --- a/llvm/lib/IR/AutoUpgrade.cpp +++ b/llvm/lib/IR/AutoUpgrade.cpp @@ -2407,14 +2407,12 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) { if (CI->arg_size() >= 3) Rep = EmitX86Select(Builder, CI->getArgOperand(2), Rep, CI->getArgOperand(1)); - } else if (IsX86 && (Name.startswith("avx512.mask.loadu."))) { - Rep = UpgradeMaskedLoad(Builder, CI->getArgOperand(0), - CI->getArgOperand(1), CI->getArgOperand(2), - /*Aligned*/false); - } else if (IsX86 && (Name.startswith("avx512.mask.load."))) { - Rep = UpgradeMaskedLoad(Builder, CI->getArgOperand(0), - CI->getArgOperand(1),CI->getArgOperand(2), - /*Aligned*/true); + } else if (IsX86 && Name.startswith("avx512.mask.load")) { + // "avx512.mask.loadu." or "avx512.mask.load." + bool Aligned = Name[16] != 'u'; // "avx512.mask.loadu". + Rep = + UpgradeMaskedLoad(Builder, CI->getArgOperand(0), CI->getArgOperand(1), + CI->getArgOperand(2), Aligned); } else if (IsX86 && Name.startswith("avx512.mask.expand.load.")) { auto *ResultTy = cast(CI->getType()); Type *PtrTy = ResultTy->getElementType(); -- 2.7.4