//===- LoopRotationUtilsTest.cpp - Unit tests for LoopRotation utility ----===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "llvm/Transforms/Utils/LoopRotationUtils.h" #include "llvm/Analysis/AssumptionCache.h" #include "llvm/Analysis/InstructionSimplify.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/ScalarEvolution.h" #include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Analysis/TargetTransformInfo.h" #include "llvm/AsmParser/Parser.h" #include "llvm/IR/Dominators.h" #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Module.h" #include "llvm/Support/SourceMgr.h" #include "gtest/gtest.h" usingnamespacellvm; static std::unique_ptr<Module> parseIR(LLVMContext &C, const char *IR) { … } /// This test contains multi-deopt-exits pattern that might allow loop rotation /// to trigger multiple times if multiple rotations are enabled. /// At least one rotation should be performed, no matter what loop rotation settings are. TEST(LoopRotate, MultiDeoptExit) { … } /// Checking a special case of multi-deopt exit loop that can not perform /// required amount of rotations due to the desired header containing /// non-duplicatable code. /// Similar to MultiDeoptExit test this one should do at least one rotation and /// pass no matter what loop rotation settings are. TEST(LoopRotate, MultiDeoptExit_Nondup) { … }