diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
commit | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch) | |
tree | 64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/libs/llvm12/lib/Target/AArch64/SVEIntrinsicOpts.cpp | |
parent | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff) | |
download | ydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/llvm12/lib/Target/AArch64/SVEIntrinsicOpts.cpp')
-rw-r--r-- | contrib/libs/llvm12/lib/Target/AArch64/SVEIntrinsicOpts.cpp | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/contrib/libs/llvm12/lib/Target/AArch64/SVEIntrinsicOpts.cpp b/contrib/libs/llvm12/lib/Target/AArch64/SVEIntrinsicOpts.cpp index e312d9d28b..9911f33371 100644 --- a/contrib/libs/llvm12/lib/Target/AArch64/SVEIntrinsicOpts.cpp +++ b/contrib/libs/llvm12/lib/Target/AArch64/SVEIntrinsicOpts.cpp @@ -37,7 +37,7 @@ using namespace llvm; using namespace llvm::PatternMatch; -#define DEBUG_TYPE "aarch64-sve-intrinsic-opts" +#define DEBUG_TYPE "aarch64-sve-intrinsic-opts" namespace llvm { void initializeSVEIntrinsicOptsPass(PassRegistry &); @@ -177,50 +177,50 @@ bool SVEIntrinsicOpts::optimizeConvertFromSVBool(IntrinsicInst *I) { if (isa<PHINode>(I->getArgOperand(0))) return processPhiNode(I); - SmallVector<Instruction *, 32> CandidatesForRemoval; - Value *Cursor = I->getOperand(0), *EarliestReplacement = nullptr; - - const auto *IVTy = cast<VectorType>(I->getType()); - - // Walk the chain of conversions. - while (Cursor) { - // If the type of the cursor has fewer lanes than the final result, zeroing - // must take place, which breaks the equivalence chain. - const auto *CursorVTy = cast<VectorType>(Cursor->getType()); - if (CursorVTy->getElementCount().getKnownMinValue() < - IVTy->getElementCount().getKnownMinValue()) - break; - - // If the cursor has the same type as I, it is a viable replacement. - if (Cursor->getType() == IVTy) - EarliestReplacement = Cursor; - - auto *IntrinsicCursor = dyn_cast<IntrinsicInst>(Cursor); - - // If this is not an SVE conversion intrinsic, this is the end of the chain. - if (!IntrinsicCursor || !(IntrinsicCursor->getIntrinsicID() == - Intrinsic::aarch64_sve_convert_to_svbool || - IntrinsicCursor->getIntrinsicID() == - Intrinsic::aarch64_sve_convert_from_svbool)) - break; - - CandidatesForRemoval.insert(CandidatesForRemoval.begin(), IntrinsicCursor); - Cursor = IntrinsicCursor->getOperand(0); - } - - // If no viable replacement in the conversion chain was found, there is - // nothing to do. - if (!EarliestReplacement) + SmallVector<Instruction *, 32> CandidatesForRemoval; + Value *Cursor = I->getOperand(0), *EarliestReplacement = nullptr; + + const auto *IVTy = cast<VectorType>(I->getType()); + + // Walk the chain of conversions. + while (Cursor) { + // If the type of the cursor has fewer lanes than the final result, zeroing + // must take place, which breaks the equivalence chain. + const auto *CursorVTy = cast<VectorType>(Cursor->getType()); + if (CursorVTy->getElementCount().getKnownMinValue() < + IVTy->getElementCount().getKnownMinValue()) + break; + + // If the cursor has the same type as I, it is a viable replacement. + if (Cursor->getType() == IVTy) + EarliestReplacement = Cursor; + + auto *IntrinsicCursor = dyn_cast<IntrinsicInst>(Cursor); + + // If this is not an SVE conversion intrinsic, this is the end of the chain. + if (!IntrinsicCursor || !(IntrinsicCursor->getIntrinsicID() == + Intrinsic::aarch64_sve_convert_to_svbool || + IntrinsicCursor->getIntrinsicID() == + Intrinsic::aarch64_sve_convert_from_svbool)) + break; + + CandidatesForRemoval.insert(CandidatesForRemoval.begin(), IntrinsicCursor); + Cursor = IntrinsicCursor->getOperand(0); + } + + // If no viable replacement in the conversion chain was found, there is + // nothing to do. + if (!EarliestReplacement) return false; - I->replaceAllUsesWith(EarliestReplacement); + I->replaceAllUsesWith(EarliestReplacement); I->eraseFromParent(); - while (!CandidatesForRemoval.empty()) { - Instruction *Candidate = CandidatesForRemoval.pop_back_val(); - if (Candidate->use_empty()) - Candidate->eraseFromParent(); - } + while (!CandidatesForRemoval.empty()) { + Instruction *Candidate = CandidatesForRemoval.pop_back_val(); + if (Candidate->use_empty()) + Candidate->eraseFromParent(); + } return true; } @@ -276,8 +276,8 @@ bool SVEIntrinsicOpts::runOnModule(Module &M) { case Intrinsic::aarch64_sve_ptest_any: case Intrinsic::aarch64_sve_ptest_first: case Intrinsic::aarch64_sve_ptest_last: - for (User *U : F.users()) - Functions.insert(cast<Instruction>(U)->getFunction()); + for (User *U : F.users()) + Functions.insert(cast<Instruction>(U)->getFunction()); break; default: break; |