Port CodeGenPrepare to new pass manager (and BasicBlockSectionsProfil… (#77182)
Port CodeGenPrepare to new pass manager and dependency BasicBlockSectionsProfileReader Fixes: #75380 Co-authored-by: Krishna-13-cyber <84722531+Krishna-13-cyber@users.noreply.github.com>
This commit is contained in:
@@ -21,11 +21,14 @@
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/PassManager.h"
|
||||
#include "llvm/InitializePasses.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/LineIterator.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace llvm {
|
||||
@@ -72,25 +75,13 @@ template <> struct DenseMapInfo<UniqueBBID> {
|
||||
}
|
||||
};
|
||||
|
||||
class BasicBlockSectionsProfileReader : public ImmutablePass {
|
||||
class BasicBlockSectionsProfileReader {
|
||||
public:
|
||||
static char ID;
|
||||
|
||||
friend class BasicBlockSectionsProfileReaderWrapperPass;
|
||||
BasicBlockSectionsProfileReader(const MemoryBuffer *Buf)
|
||||
: ImmutablePass(ID), MBuf(Buf),
|
||||
LineIt(*Buf, /*SkipBlanks=*/true, /*CommentMarker=*/'#') {
|
||||
initializeBasicBlockSectionsProfileReaderPass(
|
||||
*PassRegistry::getPassRegistry());
|
||||
};
|
||||
: MBuf(Buf), LineIt(*Buf, /*SkipBlanks=*/true, /*CommentMarker=*/'#'){};
|
||||
|
||||
BasicBlockSectionsProfileReader() : ImmutablePass(ID) {
|
||||
initializeBasicBlockSectionsProfileReaderPass(
|
||||
*PassRegistry::getPassRegistry());
|
||||
}
|
||||
|
||||
StringRef getPassName() const override {
|
||||
return "Basic Block Sections Profile Reader";
|
||||
}
|
||||
BasicBlockSectionsProfileReader(){};
|
||||
|
||||
// Returns true if basic block sections profile exist for function \p
|
||||
// FuncName.
|
||||
@@ -109,10 +100,6 @@ public:
|
||||
SmallVector<SmallVector<unsigned>>
|
||||
getClonePathsForFunction(StringRef FuncName) const;
|
||||
|
||||
// Initializes the FunctionNameToDIFilename map for the current module and
|
||||
// then reads the profile for the matching functions.
|
||||
bool doInitialization(Module &M) override;
|
||||
|
||||
private:
|
||||
StringRef getAliasName(StringRef FuncName) const {
|
||||
auto R = FuncAliasMap.find(FuncName);
|
||||
@@ -170,7 +157,61 @@ private:
|
||||
// sections profile. \p Buf is a memory buffer that contains the list of
|
||||
// functions and basic block ids to selectively enable basic block sections.
|
||||
ImmutablePass *
|
||||
createBasicBlockSectionsProfileReaderPass(const MemoryBuffer *Buf);
|
||||
createBasicBlockSectionsProfileReaderWrapperPass(const MemoryBuffer *Buf);
|
||||
|
||||
/// Analysis pass providing the \c BasicBlockSectionsProfileReader.
|
||||
///
|
||||
/// Note that this pass's result cannot be invalidated, it is immutable for the
|
||||
/// life of the module.
|
||||
class BasicBlockSectionsProfileReaderAnalysis
|
||||
: public AnalysisInfoMixin<BasicBlockSectionsProfileReaderAnalysis> {
|
||||
|
||||
public:
|
||||
static AnalysisKey Key;
|
||||
typedef BasicBlockSectionsProfileReader Result;
|
||||
BasicBlockSectionsProfileReaderAnalysis(const TargetMachine *TM) : TM(TM) {}
|
||||
|
||||
Result run(Function &F, FunctionAnalysisManager &AM);
|
||||
|
||||
private:
|
||||
const TargetMachine *TM;
|
||||
};
|
||||
|
||||
class BasicBlockSectionsProfileReaderWrapperPass : public ImmutablePass {
|
||||
public:
|
||||
static char ID;
|
||||
BasicBlockSectionsProfileReader BBSPR;
|
||||
|
||||
BasicBlockSectionsProfileReaderWrapperPass(const MemoryBuffer *Buf)
|
||||
: ImmutablePass(ID), BBSPR(BasicBlockSectionsProfileReader(Buf)) {
|
||||
initializeBasicBlockSectionsProfileReaderWrapperPassPass(
|
||||
*PassRegistry::getPassRegistry());
|
||||
};
|
||||
|
||||
BasicBlockSectionsProfileReaderWrapperPass()
|
||||
: ImmutablePass(ID), BBSPR(BasicBlockSectionsProfileReader()) {
|
||||
initializeBasicBlockSectionsProfileReaderWrapperPassPass(
|
||||
*PassRegistry::getPassRegistry());
|
||||
}
|
||||
|
||||
StringRef getPassName() const override {
|
||||
return "Basic Block Sections Profile Reader";
|
||||
}
|
||||
|
||||
bool isFunctionHot(StringRef FuncName) const;
|
||||
|
||||
std::pair<bool, SmallVector<BBClusterInfo>>
|
||||
getClusterInfoForFunction(StringRef FuncName) const;
|
||||
|
||||
SmallVector<SmallVector<unsigned>>
|
||||
getClonePathsForFunction(StringRef FuncName) const;
|
||||
|
||||
// Initializes the FunctionNameToDIFilename map for the current module and
|
||||
// then reads the profile for the matching functions.
|
||||
bool doInitialization(Module &M) override;
|
||||
|
||||
BasicBlockSectionsProfileReader &getBBSPR();
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
#endif // LLVM_CODEGEN_BASICBLOCKSECTIONSPROFILEREADER_H
|
||||
|
||||
35
llvm/include/llvm/CodeGen/CodeGenPrepare.h
Normal file
35
llvm/include/llvm/CodeGen/CodeGenPrepare.h
Normal file
@@ -0,0 +1,35 @@
|
||||
//===- CodeGenPrepare.h -----------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// 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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
/// \file
|
||||
///
|
||||
/// Defines an IR pass for CodeGen Prepare.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_CODEGEN_PREPARE_H
|
||||
#define LLVM_CODEGEN_PREPARE_H
|
||||
|
||||
#include "llvm/IR/PassManager.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class Function;
|
||||
class TargetMachine;
|
||||
|
||||
class CodeGenPreparePass : public PassInfoMixin<CodeGenPreparePass> {
|
||||
private:
|
||||
const TargetMachine *TM;
|
||||
|
||||
public:
|
||||
CodeGenPreparePass(const TargetMachine *TM) : TM(TM) {}
|
||||
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
|
||||
};
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_CODEGEN_PREPARE_H
|
||||
@@ -93,9 +93,9 @@ namespace llvm {
|
||||
MachineFunctionPass *createResetMachineFunctionPass(bool EmitFallbackDiag,
|
||||
bool AbortOnFailedISel);
|
||||
|
||||
/// createCodeGenPreparePass - Transform the code to expose more pattern
|
||||
/// createCodeGenPrepareLegacyPass - Transform the code to expose more pattern
|
||||
/// matching during instruction selection.
|
||||
FunctionPass *createCodeGenPreparePass();
|
||||
FunctionPass *createCodeGenPrepareLegacyPass();
|
||||
|
||||
/// This pass implements generation of target-specific intrinsics to support
|
||||
/// handling of complex number arithmetic
|
||||
|
||||
@@ -54,7 +54,7 @@ void initializeAssignmentTrackingAnalysisPass(PassRegistry &);
|
||||
void initializeAssumptionCacheTrackerPass(PassRegistry&);
|
||||
void initializeAtomicExpandPass(PassRegistry&);
|
||||
void initializeBasicBlockPathCloningPass(PassRegistry &);
|
||||
void initializeBasicBlockSectionsProfileReaderPass(PassRegistry &);
|
||||
void initializeBasicBlockSectionsProfileReaderWrapperPassPass(PassRegistry &);
|
||||
void initializeBasicBlockSectionsPass(PassRegistry &);
|
||||
void initializeBarrierNoopPass(PassRegistry&);
|
||||
void initializeBasicAAWrapperPassPass(PassRegistry&);
|
||||
@@ -75,7 +75,7 @@ void initializeCallGraphDOTPrinterPass(PassRegistry&);
|
||||
void initializeCallGraphViewerPass(PassRegistry&);
|
||||
void initializeCallGraphWrapperPassPass(PassRegistry&);
|
||||
void initializeCheckDebugMachineModulePass(PassRegistry &);
|
||||
void initializeCodeGenPreparePass(PassRegistry&);
|
||||
void initializeCodeGenPrepareLegacyPassPass(PassRegistry &);
|
||||
void initializeComplexDeinterleavingLegacyPassPass(PassRegistry&);
|
||||
void initializeConstantHoistingLegacyPassPass(PassRegistry&);
|
||||
void initializeCycleInfoWrapperPassPass(PassRegistry &);
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace {
|
||||
(void) llvm::createTailCallEliminationPass();
|
||||
(void)llvm::createTLSVariableHoistPass();
|
||||
(void) llvm::createConstantHoistingPass();
|
||||
(void) llvm::createCodeGenPreparePass();
|
||||
(void)llvm::createCodeGenPrepareLegacyPass();
|
||||
(void) llvm::createEarlyCSEPass();
|
||||
(void) llvm::createGVNPass();
|
||||
(void) llvm::createPostDomTree();
|
||||
|
||||
@@ -196,7 +196,7 @@ class BasicBlockPathCloning : public MachineFunctionPass {
|
||||
public:
|
||||
static char ID;
|
||||
|
||||
BasicBlockSectionsProfileReader *BBSectionsProfileReader = nullptr;
|
||||
BasicBlockSectionsProfileReaderWrapperPass *BBSectionsProfileReader = nullptr;
|
||||
|
||||
BasicBlockPathCloning() : MachineFunctionPass(ID) {
|
||||
initializeBasicBlockPathCloningPass(*PassRegistry::getPassRegistry());
|
||||
@@ -218,7 +218,7 @@ INITIALIZE_PASS_BEGIN(
|
||||
BasicBlockPathCloning, "bb-path-cloning",
|
||||
"Applies path clonings for the -basic-block-sections=list option", false,
|
||||
false)
|
||||
INITIALIZE_PASS_DEPENDENCY(BasicBlockSectionsProfileReader)
|
||||
INITIALIZE_PASS_DEPENDENCY(BasicBlockSectionsProfileReaderWrapperPass)
|
||||
INITIALIZE_PASS_END(
|
||||
BasicBlockPathCloning, "bb-path-cloning",
|
||||
"Applies path clonings for the -basic-block-sections=list option", false,
|
||||
@@ -230,13 +230,14 @@ bool BasicBlockPathCloning::runOnMachineFunction(MachineFunction &MF) {
|
||||
if (hasInstrProfHashMismatch(MF))
|
||||
return false;
|
||||
|
||||
return ApplyCloning(MF, getAnalysis<BasicBlockSectionsProfileReader>()
|
||||
.getClonePathsForFunction(MF.getName()));
|
||||
return ApplyCloning(MF,
|
||||
getAnalysis<BasicBlockSectionsProfileReaderWrapperPass>()
|
||||
.getClonePathsForFunction(MF.getName()));
|
||||
}
|
||||
|
||||
void BasicBlockPathCloning::getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.setPreservesAll();
|
||||
AU.addRequired<BasicBlockSectionsProfileReader>();
|
||||
AU.addRequired<BasicBlockSectionsProfileReaderWrapperPass>();
|
||||
MachineFunctionPass::getAnalysisUsage(AU);
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ class BasicBlockSections : public MachineFunctionPass {
|
||||
public:
|
||||
static char ID;
|
||||
|
||||
BasicBlockSectionsProfileReader *BBSectionsProfileReader = nullptr;
|
||||
BasicBlockSectionsProfileReaderWrapperPass *BBSectionsProfileReader = nullptr;
|
||||
|
||||
BasicBlockSections() : MachineFunctionPass(ID) {
|
||||
initializeBasicBlockSectionsPass(*PassRegistry::getPassRegistry());
|
||||
@@ -128,7 +128,7 @@ INITIALIZE_PASS_BEGIN(
|
||||
"Prepares for basic block sections, by splitting functions "
|
||||
"into clusters of basic blocks.",
|
||||
false, false)
|
||||
INITIALIZE_PASS_DEPENDENCY(BasicBlockSectionsProfileReader)
|
||||
INITIALIZE_PASS_DEPENDENCY(BasicBlockSectionsProfileReaderWrapperPass)
|
||||
INITIALIZE_PASS_END(BasicBlockSections, "bbsections-prepare",
|
||||
"Prepares for basic block sections, by splitting functions "
|
||||
"into clusters of basic blocks.",
|
||||
@@ -306,7 +306,7 @@ bool BasicBlockSections::runOnMachineFunction(MachineFunction &MF) {
|
||||
DenseMap<UniqueBBID, BBClusterInfo> FuncClusterInfo;
|
||||
if (BBSectionsType == BasicBlockSection::List) {
|
||||
auto [HasProfile, ClusterInfo] =
|
||||
getAnalysis<BasicBlockSectionsProfileReader>()
|
||||
getAnalysis<BasicBlockSectionsProfileReaderWrapperPass>()
|
||||
.getClusterInfoForFunction(MF.getName());
|
||||
if (!HasProfile)
|
||||
return false;
|
||||
@@ -362,7 +362,7 @@ bool BasicBlockSections::runOnMachineFunction(MachineFunction &MF) {
|
||||
|
||||
void BasicBlockSections::getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.setPreservesAll();
|
||||
AU.addRequired<BasicBlockSectionsProfileReader>();
|
||||
AU.addRequired<BasicBlockSectionsProfileReaderWrapperPass>();
|
||||
MachineFunctionPass::getAnalysisUsage(AU);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,8 +30,9 @@
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
char BasicBlockSectionsProfileReader::ID = 0;
|
||||
INITIALIZE_PASS(BasicBlockSectionsProfileReader, "bbsections-profile-reader",
|
||||
char BasicBlockSectionsProfileReaderWrapperPass::ID = 0;
|
||||
INITIALIZE_PASS(BasicBlockSectionsProfileReaderWrapperPass,
|
||||
"bbsections-profile-reader",
|
||||
"Reads and parses a basic block sections profile.", false,
|
||||
false)
|
||||
|
||||
@@ -395,11 +396,11 @@ Error BasicBlockSectionsProfileReader::ReadProfile() {
|
||||
}
|
||||
}
|
||||
|
||||
bool BasicBlockSectionsProfileReader::doInitialization(Module &M) {
|
||||
if (!MBuf)
|
||||
bool BasicBlockSectionsProfileReaderWrapperPass::doInitialization(Module &M) {
|
||||
if (!BBSPR.MBuf)
|
||||
return false;
|
||||
// Get the function name to debug info filename mapping.
|
||||
FunctionNameToDIFilename.clear();
|
||||
BBSPR.FunctionNameToDIFilename.clear();
|
||||
for (const Function &F : M) {
|
||||
SmallString<128> DIFilename;
|
||||
if (F.isDeclaration())
|
||||
@@ -411,15 +412,46 @@ bool BasicBlockSectionsProfileReader::doInitialization(Module &M) {
|
||||
DIFilename = sys::path::remove_leading_dotslash(CU->getFilename());
|
||||
}
|
||||
[[maybe_unused]] bool inserted =
|
||||
FunctionNameToDIFilename.try_emplace(F.getName(), DIFilename).second;
|
||||
BBSPR.FunctionNameToDIFilename.try_emplace(F.getName(), DIFilename)
|
||||
.second;
|
||||
assert(inserted);
|
||||
}
|
||||
if (auto Err = ReadProfile())
|
||||
if (auto Err = BBSPR.ReadProfile())
|
||||
report_fatal_error(std::move(Err));
|
||||
return false;
|
||||
}
|
||||
|
||||
ImmutablePass *
|
||||
llvm::createBasicBlockSectionsProfileReaderPass(const MemoryBuffer *Buf) {
|
||||
return new BasicBlockSectionsProfileReader(Buf);
|
||||
AnalysisKey BasicBlockSectionsProfileReaderAnalysis::Key;
|
||||
|
||||
BasicBlockSectionsProfileReader
|
||||
BasicBlockSectionsProfileReaderAnalysis::run(Function &F,
|
||||
FunctionAnalysisManager &AM) {
|
||||
return BasicBlockSectionsProfileReader(TM->getBBSectionsFuncListBuf());
|
||||
}
|
||||
|
||||
bool BasicBlockSectionsProfileReaderWrapperPass::isFunctionHot(
|
||||
StringRef FuncName) const {
|
||||
return BBSPR.isFunctionHot(FuncName);
|
||||
}
|
||||
|
||||
std::pair<bool, SmallVector<BBClusterInfo>>
|
||||
BasicBlockSectionsProfileReaderWrapperPass::getClusterInfoForFunction(
|
||||
StringRef FuncName) const {
|
||||
return BBSPR.getClusterInfoForFunction(FuncName);
|
||||
}
|
||||
|
||||
SmallVector<SmallVector<unsigned>>
|
||||
BasicBlockSectionsProfileReaderWrapperPass::getClonePathsForFunction(
|
||||
StringRef FuncName) const {
|
||||
return BBSPR.getClonePathsForFunction(FuncName);
|
||||
}
|
||||
|
||||
BasicBlockSectionsProfileReader &
|
||||
BasicBlockSectionsProfileReaderWrapperPass::getBBSPR() {
|
||||
return BBSPR;
|
||||
}
|
||||
|
||||
ImmutablePass *llvm::createBasicBlockSectionsProfileReaderWrapperPass(
|
||||
const MemoryBuffer *Buf) {
|
||||
return new BasicBlockSectionsProfileReaderWrapperPass(Buf);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ void llvm::initializeCodeGen(PassRegistry &Registry) {
|
||||
initializeCFIFixupPass(Registry);
|
||||
initializeCFIInstrInserterPass(Registry);
|
||||
initializeCheckDebugMachineModulePass(Registry);
|
||||
initializeCodeGenPreparePass(Registry);
|
||||
initializeCodeGenPrepareLegacyPassPass(Registry);
|
||||
initializeDeadMachineInstructionElimPass(Registry);
|
||||
initializeDebugifyMachineModulePass(Registry);
|
||||
initializeDetectDeadLanesPass(Registry);
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/CodeGen/CodeGenPrepare.h"
|
||||
#include "llvm/ADT/APInt.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
@@ -301,7 +302,8 @@ using ValueToSExts = MapVector<Value *, SExts>;
|
||||
|
||||
class TypePromotionTransaction;
|
||||
|
||||
class CodeGenPrepare : public FunctionPass {
|
||||
class CodeGenPrepare {
|
||||
friend class CodeGenPrepareLegacyPass;
|
||||
const TargetMachine *TM = nullptr;
|
||||
const TargetSubtargetInfo *SubtargetInfo = nullptr;
|
||||
const TargetLowering *TLI = nullptr;
|
||||
@@ -365,6 +367,8 @@ class CodeGenPrepare : public FunctionPass {
|
||||
std::unique_ptr<DominatorTree> DT;
|
||||
|
||||
public:
|
||||
CodeGenPrepare(){};
|
||||
CodeGenPrepare(const TargetMachine *TM) : TM(TM){};
|
||||
/// If encounter huge function, we need to limit the build time.
|
||||
bool IsHugeFunc = false;
|
||||
|
||||
@@ -374,15 +378,7 @@ public:
|
||||
/// to insert such BB into FreshBBs for huge function.
|
||||
SmallSet<BasicBlock *, 32> FreshBBs;
|
||||
|
||||
static char ID; // Pass identification, replacement for typeid
|
||||
|
||||
CodeGenPrepare() : FunctionPass(ID) {
|
||||
initializeCodeGenPreparePass(*PassRegistry::getPassRegistry());
|
||||
}
|
||||
|
||||
bool runOnFunction(Function &F) override;
|
||||
|
||||
void releaseMemory() override {
|
||||
void releaseMemory() {
|
||||
// Clear per function information.
|
||||
InsertedInsts.clear();
|
||||
PromotedInsts.clear();
|
||||
@@ -391,17 +387,7 @@ public:
|
||||
BFI.reset();
|
||||
}
|
||||
|
||||
StringRef getPassName() const override { return "CodeGen Prepare"; }
|
||||
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||
// FIXME: When we can selectively preserve passes, preserve the domtree.
|
||||
AU.addRequired<ProfileSummaryInfoWrapperPass>();
|
||||
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||
AU.addRequired<TargetPassConfig>();
|
||||
AU.addRequired<TargetTransformInfoWrapperPass>();
|
||||
AU.addRequired<LoopInfoWrapperPass>();
|
||||
AU.addUsedIfAvailable<BasicBlockSectionsProfileReader>();
|
||||
}
|
||||
bool run(Function &F, FunctionAnalysisManager &AM);
|
||||
|
||||
private:
|
||||
template <typename F>
|
||||
@@ -488,45 +474,108 @@ private:
|
||||
bool combineToUSubWithOverflow(CmpInst *Cmp, ModifyDT &ModifiedDT);
|
||||
bool combineToUAddWithOverflow(CmpInst *Cmp, ModifyDT &ModifiedDT);
|
||||
void verifyBFIUpdates(Function &F);
|
||||
bool _run(Function &F);
|
||||
};
|
||||
|
||||
class CodeGenPrepareLegacyPass : public FunctionPass {
|
||||
public:
|
||||
static char ID; // Pass identification, replacement for typeid
|
||||
|
||||
CodeGenPrepareLegacyPass() : FunctionPass(ID) {
|
||||
initializeCodeGenPrepareLegacyPassPass(*PassRegistry::getPassRegistry());
|
||||
}
|
||||
|
||||
bool runOnFunction(Function &F) override;
|
||||
|
||||
StringRef getPassName() const override { return "CodeGen Prepare"; }
|
||||
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||
// FIXME: When we can selectively preserve passes, preserve the domtree.
|
||||
AU.addRequired<ProfileSummaryInfoWrapperPass>();
|
||||
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||
AU.addRequired<TargetPassConfig>();
|
||||
AU.addRequired<TargetTransformInfoWrapperPass>();
|
||||
AU.addRequired<LoopInfoWrapperPass>();
|
||||
AU.addUsedIfAvailable<BasicBlockSectionsProfileReaderWrapperPass>();
|
||||
}
|
||||
};
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
char CodeGenPrepare::ID = 0;
|
||||
char CodeGenPrepareLegacyPass::ID = 0;
|
||||
|
||||
INITIALIZE_PASS_BEGIN(CodeGenPrepare, DEBUG_TYPE,
|
||||
bool CodeGenPrepareLegacyPass::runOnFunction(Function &F) {
|
||||
if (skipFunction(F))
|
||||
return false;
|
||||
auto TM = &getAnalysis<TargetPassConfig>().getTM<TargetMachine>();
|
||||
CodeGenPrepare CGP(TM);
|
||||
CGP.DL = &F.getParent()->getDataLayout();
|
||||
CGP.SubtargetInfo = TM->getSubtargetImpl(F);
|
||||
CGP.TLI = CGP.SubtargetInfo->getTargetLowering();
|
||||
CGP.TRI = CGP.SubtargetInfo->getRegisterInfo();
|
||||
CGP.TLInfo = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(F);
|
||||
CGP.TTI = &getAnalysis<TargetTransformInfoWrapperPass>().getTTI(F);
|
||||
CGP.LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
|
||||
CGP.BPI.reset(new BranchProbabilityInfo(F, *CGP.LI));
|
||||
CGP.BFI.reset(new BlockFrequencyInfo(F, *CGP.BPI, *CGP.LI));
|
||||
CGP.PSI = &getAnalysis<ProfileSummaryInfoWrapperPass>().getPSI();
|
||||
auto BBSPRWP =
|
||||
getAnalysisIfAvailable<BasicBlockSectionsProfileReaderWrapperPass>();
|
||||
CGP.BBSectionsProfileReader = BBSPRWP ? &BBSPRWP->getBBSPR() : nullptr;
|
||||
|
||||
return CGP._run(F);
|
||||
}
|
||||
|
||||
INITIALIZE_PASS_BEGIN(CodeGenPrepareLegacyPass, DEBUG_TYPE,
|
||||
"Optimize for code generation", false, false)
|
||||
INITIALIZE_PASS_DEPENDENCY(BasicBlockSectionsProfileReader)
|
||||
INITIALIZE_PASS_DEPENDENCY(BasicBlockSectionsProfileReaderWrapperPass)
|
||||
INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass)
|
||||
INITIALIZE_PASS_DEPENDENCY(ProfileSummaryInfoWrapperPass)
|
||||
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
|
||||
INITIALIZE_PASS_DEPENDENCY(TargetPassConfig)
|
||||
INITIALIZE_PASS_DEPENDENCY(TargetTransformInfoWrapperPass)
|
||||
INITIALIZE_PASS_END(CodeGenPrepare, DEBUG_TYPE, "Optimize for code generation",
|
||||
false, false)
|
||||
INITIALIZE_PASS_END(CodeGenPrepareLegacyPass, DEBUG_TYPE,
|
||||
"Optimize for code generation", false, false)
|
||||
|
||||
FunctionPass *llvm::createCodeGenPreparePass() { return new CodeGenPrepare(); }
|
||||
FunctionPass *llvm::createCodeGenPrepareLegacyPass() {
|
||||
return new CodeGenPrepareLegacyPass();
|
||||
}
|
||||
|
||||
bool CodeGenPrepare::runOnFunction(Function &F) {
|
||||
if (skipFunction(F))
|
||||
return false;
|
||||
PreservedAnalyses CodeGenPreparePass::run(Function &F,
|
||||
FunctionAnalysisManager &AM) {
|
||||
CodeGenPrepare CGP(TM);
|
||||
|
||||
bool Changed = CGP.run(F, AM);
|
||||
if (!Changed)
|
||||
return PreservedAnalyses::all();
|
||||
|
||||
PreservedAnalyses PA;
|
||||
PA.preserve<TargetLibraryAnalysis>();
|
||||
PA.preserve<TargetIRAnalysis>();
|
||||
PA.preserve<LoopAnalysis>();
|
||||
return PA;
|
||||
}
|
||||
|
||||
bool CodeGenPrepare::run(Function &F, FunctionAnalysisManager &AM) {
|
||||
DL = &F.getParent()->getDataLayout();
|
||||
|
||||
bool EverMadeChange = false;
|
||||
|
||||
TM = &getAnalysis<TargetPassConfig>().getTM<TargetMachine>();
|
||||
SubtargetInfo = TM->getSubtargetImpl(F);
|
||||
TLI = SubtargetInfo->getTargetLowering();
|
||||
TRI = SubtargetInfo->getRegisterInfo();
|
||||
TLInfo = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(F);
|
||||
TTI = &getAnalysis<TargetTransformInfoWrapperPass>().getTTI(F);
|
||||
LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
|
||||
TLInfo = &AM.getResult<TargetLibraryAnalysis>(F);
|
||||
TTI = &AM.getResult<TargetIRAnalysis>(F);
|
||||
LI = &AM.getResult<LoopAnalysis>(F);
|
||||
BPI.reset(new BranchProbabilityInfo(F, *LI));
|
||||
BFI.reset(new BlockFrequencyInfo(F, *BPI, *LI));
|
||||
PSI = &getAnalysis<ProfileSummaryInfoWrapperPass>().getPSI();
|
||||
auto &MAMProxy = AM.getResult<ModuleAnalysisManagerFunctionProxy>(F);
|
||||
PSI = MAMProxy.getCachedResult<ProfileSummaryAnalysis>(*F.getParent());
|
||||
BBSectionsProfileReader =
|
||||
getAnalysisIfAvailable<BasicBlockSectionsProfileReader>();
|
||||
AM.getCachedResult<BasicBlockSectionsProfileReaderAnalysis>(F);
|
||||
return _run(F);
|
||||
}
|
||||
|
||||
bool CodeGenPrepare::_run(Function &F) {
|
||||
bool EverMadeChange = false;
|
||||
|
||||
OptSize = F.hasOptSize();
|
||||
// Use the basic-block-sections profile to promote hot functions to .text.hot
|
||||
// if requested.
|
||||
|
||||
@@ -978,7 +978,7 @@ void TargetPassConfig::addPassesToHandleExceptions() {
|
||||
/// before exception handling preparation passes.
|
||||
void TargetPassConfig::addCodeGenPrepare() {
|
||||
if (getOptLevel() != CodeGenOptLevel::None && !DisableCGP)
|
||||
addPass(createCodeGenPreparePass());
|
||||
addPass(createCodeGenPrepareLegacyPass());
|
||||
}
|
||||
|
||||
/// Add common passes that perform LLVM IR to IR transforms in preparation for
|
||||
@@ -1271,7 +1271,7 @@ void TargetPassConfig::addMachinePasses() {
|
||||
// together. Update this check once we have addressed any issues.
|
||||
if (TM->getBBSectionsType() != llvm::BasicBlockSection::None) {
|
||||
if (TM->getBBSectionsType() == llvm::BasicBlockSection::List) {
|
||||
addPass(llvm::createBasicBlockSectionsProfileReaderPass(
|
||||
addPass(llvm::createBasicBlockSectionsProfileReaderWrapperPass(
|
||||
TM->getBBSectionsFuncListBuf()));
|
||||
addPass(llvm::createBasicBlockPathCloningPass());
|
||||
}
|
||||
|
||||
@@ -72,7 +72,9 @@
|
||||
#include "llvm/Analysis/TargetTransformInfo.h"
|
||||
#include "llvm/Analysis/TypeBasedAliasAnalysis.h"
|
||||
#include "llvm/Analysis/UniformityAnalysis.h"
|
||||
#include "llvm/CodeGen/BasicBlockSectionsProfileReader.h"
|
||||
#include "llvm/CodeGen/CallBrPrepare.h"
|
||||
#include "llvm/CodeGen/CodeGenPrepare.h"
|
||||
#include "llvm/CodeGen/DwarfEHPrepare.h"
|
||||
#include "llvm/CodeGen/ExpandLargeDivRem.h"
|
||||
#include "llvm/CodeGen/ExpandLargeFpConvert.h"
|
||||
|
||||
@@ -230,6 +230,7 @@ CGSCC_PASS_WITH_PARAMS(
|
||||
FUNCTION_ANALYSIS("aa", AAManager())
|
||||
FUNCTION_ANALYSIS("access-info", LoopAccessAnalysis())
|
||||
FUNCTION_ANALYSIS("assumptions", AssumptionAnalysis())
|
||||
FUNCTION_ANALYSIS("bb-sections-profile-reader", BasicBlockSectionsProfileReaderAnalysis(TM))
|
||||
FUNCTION_ANALYSIS("block-freq", BlockFrequencyAnalysis())
|
||||
FUNCTION_ANALYSIS("branch-prob", BranchProbabilityAnalysis())
|
||||
FUNCTION_ANALYSIS("cycles", CycleAnalysis())
|
||||
@@ -291,6 +292,7 @@ FUNCTION_PASS("break-crit-edges", BreakCriticalEdgesPass())
|
||||
FUNCTION_PASS("callbrprepare", CallBrPreparePass())
|
||||
FUNCTION_PASS("callsite-splitting", CallSiteSplittingPass())
|
||||
FUNCTION_PASS("chr", ControlHeightReductionPass())
|
||||
FUNCTION_PASS("codegenprepare", CodeGenPreparePass(TM))
|
||||
FUNCTION_PASS("consthoist", ConstantHoistingPass())
|
||||
FUNCTION_PASS("constraint-elimination", ConstraintEliminationPass())
|
||||
FUNCTION_PASS("coro-elide", CoroElidePass())
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -codegenprepare < %s -S | FileCheck %s
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' < %s -S | FileCheck %s
|
||||
|
||||
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
|
||||
target triple = "aarch64--linux-gnu"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
; RUN: llc -mtriple=aarch64-linux-gnu -verify-machineinstrs < %s | FileCheck %s
|
||||
; RUN: opt -S -codegenprepare -mtriple=aarch64-linux %s | FileCheck --check-prefix=CHECK-CGP %s
|
||||
; RUN: opt -S -codegenprepare -cgpp-huge-func=0 -mtriple=aarch64-linux %s | FileCheck --check-prefix=CHECK-CGP %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -mtriple=aarch64-linux %s | FileCheck --check-prefix=CHECK-CGP %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -cgpp-huge-func=0 -mtriple=aarch64-linux %s | FileCheck --check-prefix=CHECK-CGP %s
|
||||
|
||||
@A = dso_local global i32 zeroinitializer
|
||||
@B = dso_local global i32 zeroinitializer
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -codegenprepare -mtriple=arm64-apple=ios -S -o - %s | FileCheck --check-prefix=OPT %s
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -mtriple=arm64-apple=ios -S -o - %s | FileCheck --check-prefix=OPT %s
|
||||
; RUN: llc < %s -mtriple=arm64-eabi | FileCheck --check-prefix=LLC %s
|
||||
|
||||
%struct.X = type { i8, i8, [2 x i8] }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
; RUN: opt -codegenprepare < %s -mtriple=aarch64-apple-ios -S | FileCheck -enable-var-scope %s --check-prefix=OPTALL --check-prefix=OPT --check-prefix=NONSTRESS
|
||||
; RUN: opt -codegenprepare < %s -mtriple=aarch64-apple-ios -S -stress-cgp-ext-ld-promotion | FileCheck -enable-var-scope %s --check-prefix=OPTALL --check-prefix=OPT --check-prefix=STRESS
|
||||
; RUN: opt -codegenprepare < %s -mtriple=aarch64-apple-ios -S -disable-cgp-ext-ld-promotion | FileCheck -enable-var-scope %s --check-prefix=OPTALL --check-prefix=DISABLE
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' < %s -mtriple=aarch64-apple-ios -S | FileCheck -enable-var-scope %s --check-prefix=OPTALL --check-prefix=OPT --check-prefix=NONSTRESS
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' < %s -mtriple=aarch64-apple-ios -S -stress-cgp-ext-ld-promotion | FileCheck -enable-var-scope %s --check-prefix=OPTALL --check-prefix=OPT --check-prefix=STRESS
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' < %s -mtriple=aarch64-apple-ios -S -disable-cgp-ext-ld-promotion | FileCheck -enable-var-scope %s --check-prefix=OPTALL --check-prefix=DISABLE
|
||||
|
||||
; CodeGenPrepare should move the zext into the block with the load
|
||||
; so that SelectionDAG can select it with the load.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
|
||||
; RUN: opt -codegenprepare -mtriple=arm64_32-apple-ios %s -S -o - | FileCheck %s
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -mtriple=arm64_32-apple-ios %s -S -o - | FileCheck %s
|
||||
|
||||
define void @test_simple_sink(ptr %base, i64 %offset) {
|
||||
; CHECK-LABEL: define void @test_simple_sink(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; Checks that case when GEP is bound to trivial PHI node is correctly handled.
|
||||
; RUN: opt %s -mtriple=aarch64-linux-gnu -codegenprepare -S -o - | FileCheck %s
|
||||
; RUN: opt %s -mtriple=aarch64-linux-gnu -passes='require<profile-summary>,function(codegenprepare)' -S -o - | FileCheck %s
|
||||
|
||||
; CHECK: define void @crash(ptr %s, i32 %n) {
|
||||
; CHECK-NEXT: entry:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -codegenprepare -cgp-optimize-phi-types %s -S | FileCheck %s
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -cgp-optimize-phi-types %s -S | FileCheck %s
|
||||
|
||||
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
|
||||
target triple = "aarch64--linux-gnu"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -mtriple=aarch64 -codegenprepare -S < %s | FileCheck %s
|
||||
; RUN: opt -mtriple=aarch64 -passes='require<profile-summary>,function(codegenprepare)' -S < %s | FileCheck %s
|
||||
|
||||
; This test intends to check vector promotion for scalable vector. Current target lowering
|
||||
; rejects scalable vector before reaching getConstantVector() in CodeGenPrepare. This test
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; RUN: llc -mtriple aarch64 -mattr=+sve -asm-verbose=0 < %s | FileCheck %s
|
||||
; RUN: opt -mtriple=aarch64 -codegenprepare -S < %s | llc -mtriple=aarch64 -mattr=+sve -asm-verbose=0 | FileCheck %s
|
||||
; RUN: opt -mtriple=aarch64 -passes='require<profile-summary>,function(codegenprepare)' -S < %s | llc -mtriple=aarch64 -mattr=+sve -asm-verbose=0 | FileCheck %s
|
||||
|
||||
;
|
||||
; RDVL
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
|
||||
; RUN: opt -codegenprepare -S -o - %s | FileCheck %s
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -S -o - %s | FileCheck %s
|
||||
|
||||
target triple = "aarch64-unknown-linux-gnu"
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
||||
; RUN: opt -S -codegenprepare -mtriple=amdgcn-unknown-unknown -mcpu=bonaire < %s | FileCheck --check-prefixes=OPT,OPT-GFX7 %s
|
||||
; RUN: opt -S -codegenprepare -mtriple=amdgcn-unknown-unknown -mcpu=tonga < %s | FileCheck --check-prefixes=OPT,OPT-GFX8 %s
|
||||
; RUN: opt -S -codegenprepare -mtriple=amdgcn-unknown-unknown -mcpu=gfx900 < %s | FileCheck --check-prefixes=OPT,OPT-GFX9 %s
|
||||
; RUN: opt -S -codegenprepare -mtriple=amdgcn-unknown-unknown -mcpu=gfx1030 < %s | FileCheck --check-prefixes=OPT,OPT-GFX10 %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -mtriple=amdgcn-unknown-unknown -mcpu=bonaire < %s | FileCheck --check-prefixes=OPT,OPT-GFX7 %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -mtriple=amdgcn-unknown-unknown -mcpu=tonga < %s | FileCheck --check-prefixes=OPT,OPT-GFX8 %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -mtriple=amdgcn-unknown-unknown -mcpu=gfx900 < %s | FileCheck --check-prefixes=OPT,OPT-GFX9 %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -mtriple=amdgcn-unknown-unknown -mcpu=gfx1030 < %s | FileCheck --check-prefixes=OPT,OPT-GFX10 %s
|
||||
|
||||
; RUN: llc -march=amdgcn -mcpu=bonaire < %s | FileCheck --check-prefix=GFX7 %s
|
||||
; RUN: llc -march=amdgcn -mcpu=tonga < %s | FileCheck --check-prefix=GFX8 %s
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
||||
; RUN: opt -S -codegenprepare -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1030 < %s | FileCheck -check-prefix=OPT %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1030 < %s | FileCheck -check-prefix=OPT %s
|
||||
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1030 < %s | FileCheck -check-prefix=GCN %s
|
||||
|
||||
; Make sure we match the addressing mode offset of csub intrinsics across blocks.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
||||
; RUN: opt -S -codegenprepare -mtriple=amdgcn-amd-amdhsa -mcpu=gfx908 < %s | FileCheck -check-prefix=OPT %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -mtriple=amdgcn-amd-amdhsa -mcpu=gfx908 < %s | FileCheck -check-prefix=OPT %s
|
||||
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx908 < %s | FileCheck -check-prefix=GCN %s
|
||||
|
||||
; Make sure we match the addressing mode offset of globla.atomic.fadd intrinsics across blocks.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
; RUN: opt -S -codegenprepare -mtriple=amdgcn-unknown-unknown -mcpu=tahiti < %s | FileCheck -check-prefix=OPT -check-prefix=OPT-SI -check-prefix=OPT-SICIVI %s
|
||||
; RUN: opt -S -codegenprepare -mtriple=amdgcn-unknown-unknown -mcpu=bonaire < %s | FileCheck -check-prefix=OPT -check-prefix=OPT-CI -check-prefix=OPT-SICIVI %s
|
||||
; RUN: opt -S -codegenprepare -mtriple=amdgcn-unknown-unknown -mcpu=tonga -mattr=-flat-for-global < %s | FileCheck -check-prefix=OPT -check-prefix=OPT-VI -check-prefix=OPT-SICIVI %s
|
||||
; RUN: opt -S -codegenprepare -mtriple=amdgcn-unknown-unknown -mcpu=gfx900 < %s | FileCheck -check-prefix=OPT -check-prefix=OPT-GFX9 %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -mtriple=amdgcn-unknown-unknown -mcpu=tahiti < %s | FileCheck -check-prefix=OPT -check-prefix=OPT-SI -check-prefix=OPT-SICIVI %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -mtriple=amdgcn-unknown-unknown -mcpu=bonaire < %s | FileCheck -check-prefix=OPT -check-prefix=OPT-CI -check-prefix=OPT-SICIVI %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -mtriple=amdgcn-unknown-unknown -mcpu=tonga -mattr=-flat-for-global < %s | FileCheck -check-prefix=OPT -check-prefix=OPT-VI -check-prefix=OPT-SICIVI %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -mtriple=amdgcn-unknown-unknown -mcpu=gfx900 < %s | FileCheck -check-prefix=OPT -check-prefix=OPT-GFX9 %s
|
||||
; RUN: llc -march=amdgcn -mcpu=tahiti -mattr=-promote-alloca -amdgpu-scalarize-global-loads=false < %s | FileCheck -check-prefix=GCN -check-prefix=SI -check-prefix=SICIVI %s
|
||||
; RUN: llc -march=amdgcn -mcpu=bonaire -mattr=-promote-alloca -amdgpu-scalarize-global-loads=false < %s | FileCheck -check-prefix=GCN -check-prefix=CI -check-prefix=SICIVI %s
|
||||
; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -amdgpu-scalarize-global-loads=false -mattr=-promote-alloca < %s | FileCheck -check-prefix=GCN -check-prefix=VI -check-prefix=SICIVI %s
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; RUN: opt -codegenprepare -mtriple=thumbv7-apple-ios %s -o - -mattr=+neon -S | FileCheck --check-prefix=IR-BOTH --check-prefix=IR-NORMAL %s
|
||||
; RUN: opt -codegenprepare -mtriple=thumbv7-apple-ios %s -o - -mattr=+neon -S -stress-cgp-store-extract | FileCheck --check-prefix=IR-BOTH --check-prefix=IR-STRESS %s
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -mtriple=thumbv7-apple-ios %s -o - -mattr=+neon -S | FileCheck --check-prefix=IR-BOTH --check-prefix=IR-NORMAL %s
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -mtriple=thumbv7-apple-ios %s -o - -mattr=+neon -S -stress-cgp-store-extract | FileCheck --check-prefix=IR-BOTH --check-prefix=IR-STRESS %s
|
||||
; RUN: llc -mtriple=thumbv7-apple-ios %s -o - -mattr=+neon | FileCheck --check-prefix=ASM %s
|
||||
|
||||
; IR-BOTH-LABEL: @simpleOneInstructionPromotion
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -S -codegenprepare < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s
|
||||
; REQUIRES: aarch64-registered-target
|
||||
|
||||
; Check that we don't give up if unable to sink the first argument.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -S -codegenprepare < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s
|
||||
; REQUIRES: aarch64-registered-target
|
||||
|
||||
; Test that `%addr` is sunk, after we've increased limit on the number of the memory uses to scan.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
;; RUN: opt -S -codegenprepare < %s | FileCheck %s
|
||||
;; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s
|
||||
|
||||
;; Ensure that codegenprepare (via InstSimplify) doesn't eliminate the
|
||||
;; phi here (which would cause a module verification error).
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -S -codegenprepare %s -o - | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' %s -o - | FileCheck %s
|
||||
; This file tests the different cases what are involved when codegen prepare
|
||||
; tries to get sign/zero extension out of the way of addressing mode.
|
||||
; This tests require an actual target as addressing mode decisions depends
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
|
||||
; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s
|
||||
; RUN: llc < %s -mtriple=x86_64-win64 | FileCheck %s
|
||||
; RUN: opt -codegenprepare < %s -mtriple=x86_64-apple-macosx -S | FileCheck %s --check-prefix=OPTALL --check-prefix=OPT --check-prefix=NONSTRESS
|
||||
; RUN: opt -codegenprepare < %s -mtriple=x86_64-apple-macosx -S -stress-cgp-ext-ld-promotion | FileCheck %s --check-prefix=OPTALL --check-prefix=OPT --check-prefix=STRESS
|
||||
; RUN: opt -codegenprepare < %s -mtriple=x86_64-apple-macosx -S -disable-cgp-ext-ld-promotion | FileCheck %s --check-prefix=OPTALL --check-prefix=DISABLE
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' < %s -mtriple=x86_64-apple-macosx -S | FileCheck %s --check-prefix=OPTALL --check-prefix=OPT --check-prefix=NONSTRESS
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' < %s -mtriple=x86_64-apple-macosx -S -stress-cgp-ext-ld-promotion | FileCheck %s --check-prefix=OPTALL --check-prefix=OPT --check-prefix=STRESS
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' < %s -mtriple=x86_64-apple-macosx -S -disable-cgp-ext-ld-promotion | FileCheck %s --check-prefix=OPTALL --check-prefix=DISABLE
|
||||
|
||||
; rdar://7304838
|
||||
; CodeGenPrepare should move the zext into the block with the load
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -codegenprepare -cgp-optimize-phi-types=true %s -S | FileCheck %s
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -cgp-optimize-phi-types=true %s -S | FileCheck %s
|
||||
|
||||
target datalayout = "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128"
|
||||
target triple = "i386-unknown-linux-gnu"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
|
||||
; RUN: opt -S -codegenprepare %s -o - | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' %s -o - | FileCheck %s
|
||||
|
||||
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; RUN: opt -codegenprepare -mtriple=x86_64 %s -S -o - | FileCheck %s
|
||||
; RUN: opt -codegenprepare -mtriple=i386 %s -S -o - | FileCheck %s
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -mtriple=x86_64 %s -S -o - | FileCheck %s
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -mtriple=i386 %s -S -o - | FileCheck %s
|
||||
|
||||
define i32 @f(i32 %0) {
|
||||
; CHECK-LABEL: @f
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
||||
; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck %s
|
||||
; RUN: opt -S -codegenprepare %s -mtriple=x86_64-apple-darwin -o - | FileCheck %s --check-prefix OPT
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' %s -mtriple=x86_64-apple-darwin -o - | FileCheck %s --check-prefix OPT
|
||||
|
||||
; Teach CGP to dup returns to enable tail call optimization.
|
||||
; rdar://9147433
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; RUN: llc -mtriple=x86_64-linux < %s | FileCheck %s
|
||||
; RUN: opt -codegenprepare -S -mtriple=x86_64-linux < %s | FileCheck %s --check-prefix OPT
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -S -mtriple=x86_64-linux < %s | FileCheck %s --check-prefix OPT
|
||||
|
||||
|
||||
; The exit block containing extractvalue can be duplicated into the BB
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -codegenprepare -S %s -o - | FileCheck %s
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -S %s -o - | FileCheck %s
|
||||
; typedef struct info {
|
||||
; unsigned long long size;
|
||||
; } info_t;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -S -codegenprepare < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s
|
||||
;
|
||||
; This test case was generated from the following source code:
|
||||
;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -codegenprepare -S < %s | FileCheck %s
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -S < %s | FileCheck %s
|
||||
; RUN: opt -strip-debug -codegenprepare -S < %s | FileCheck %s
|
||||
; REQUIRES: x86-registered-target
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -S -codegenprepare -mtriple=aarch64-none-linux-gnu < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -mtriple=aarch64-none-linux-gnu < %s | FileCheck %s
|
||||
|
||||
@_MergedGlobals = external dso_local global <{ i32, i32 }>, align 4
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -S -codegenprepare -mtriple=aarch64-linux %s | FileCheck -enable-var-scope %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -mtriple=aarch64-linux %s | FileCheck -enable-var-scope %s
|
||||
|
||||
; Test for CodeGenPrepare::optimizeLoadExt(): simple case: two loads
|
||||
; feeding a phi that zext's each loaded value.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -S -codegenprepare < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s
|
||||
|
||||
target triple = "aarch64-unknown-linux-gnu"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -S -codegenprepare < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s
|
||||
|
||||
target triple = "aarch64-unknown-linux-gnu"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -codegenprepare -S < %s | FileCheck %s
|
||||
; RUN: opt -enable-debugify -codegenprepare -S < %s 2>&1 | FileCheck %s -check-prefix=DEBUG
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -S < %s | FileCheck %s
|
||||
; RUN: opt -enable-debugify -passes='require<profile-summary>,function(codegenprepare)' -S < %s 2>&1 | FileCheck %s -check-prefix=DEBUG
|
||||
|
||||
; Subset of tests from llvm/tests/Transforms/CodeGenPrepare/X86/overflow-intrinsics.ll
|
||||
; to test shouldFormOverflowOp on SPARC, where it is not profitable to create
|
||||
@@ -167,5 +167,5 @@ define i1 @usubo_ult_i64_math_overflow_used(i64 %x, i64 %y, ptr %p) {
|
||||
ret i1 %ov
|
||||
}
|
||||
|
||||
; Check that every instruction inserted by -codegenprepare has a debug location.
|
||||
; Check that every instruction inserted by -passes='require<profile-summary>,function(codegenprepare)' has a debug location.
|
||||
; DEBUG: CheckModuleDebugify: PASS
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
|
||||
; RUN: opt -S --codegenprepare < %s | FileCheck %s
|
||||
; RUN: opt -S --passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s
|
||||
|
||||
target triple = "aarch64-unknown-linux-gnu"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -S -codegenprepare -mtriple=arm64-apple-ios7.0 %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -mtriple=arm64-apple-ios7.0 %s | FileCheck %s
|
||||
|
||||
%foo = type { i8 }
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -codegenprepare -S %s | FileCheck %s
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -S %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
|
||||
target triple = "arm64-apple-ios"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -S -codegenprepare -mtriple=amdgcn--amdhsa < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -mtriple=amdgcn--amdhsa < %s | FileCheck %s
|
||||
|
||||
define amdgpu_kernel void @test_sink_as999_small_max_mubuf_offset(ptr addrspace(999) %out, ptr addrspace(999) %in) {
|
||||
; CHECK-LABEL: @test_sink_as999_small_max_mubuf_offset(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -S -codegenprepare -mtriple=amdgcn-unknown-unknown < %s | FileCheck -check-prefix=ASC -check-prefix=COMMON %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -mtriple=amdgcn-unknown-unknown < %s | FileCheck -check-prefix=ASC -check-prefix=COMMON %s
|
||||
|
||||
; COMMON-LABEL: @test_sink_ptrtoint_asc(
|
||||
; ASC: addrspacecast
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
|
||||
; RUN: opt -S -codegenprepare -mtriple=amdgcn--amdhsa < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -mtriple=amdgcn--amdhsa < %s | FileCheck %s
|
||||
|
||||
define i64 @no_sink_local_to_flat(i1 %pred, ptr addrspace(3) %ptr) {
|
||||
; CHECK-LABEL: define i64 @no_sink_local_to_flat(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -S -codegenprepare < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
|
||||
target triple = "thumbv8.1m.main-none-eabi"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -codegenprepare -S %s -o - | FileCheck %s
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -S %s -o - | FileCheck %s
|
||||
target triple = "thumbv7-apple-ios7.0.0"
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -codegenprepare -mtriple=arm7-unknown-unknown -S < %s | FileCheck %s
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -mtriple=arm7-unknown-unknown -S < %s | FileCheck %s
|
||||
|
||||
declare void @llvm.memcpy.p0.p0.i32(ptr, ptr, i32, i1) nounwind
|
||||
declare void @llvm.memmove.p0.p0.i32(ptr, ptr, i32, i1) nounwind
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -codegenprepare -S < %s | FileCheck %s
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -S < %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
|
||||
target triple = "thumbv8m.main-arm-none-eabi"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -S -codegenprepare -mtriple=thumbv7m -disable-complex-addr-modes=false -addr-sink-new-select=true -addr-sink-new-phis=true < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -mtriple=thumbv7m -disable-complex-addr-modes=false -addr-sink-new-select=true -addr-sink-new-phis=true < %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -S -codegenprepare %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
|
||||
target triple = "thumbv6m-arm-none-eabi"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -codegenprepare -S < %s | FileCheck %s
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -S < %s | FileCheck %s
|
||||
|
||||
target triple = "armv8m.main-none-eabi"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -S -codegenprepare < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64"
|
||||
target triple = "nvptx64-nvidia-cuda"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -S -codegenprepare < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64"
|
||||
target triple = "nvptx64-nvidia-cuda"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -S -codegenprepare < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64"
|
||||
target triple = "nvptx64-nvidia-cuda"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -S -codegenprepare < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64"
|
||||
target triple = "nvptx64-nvidia-cuda"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -S -codegenprepare < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64"
|
||||
target triple = "nvptx64-nvidia-cuda"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -S -codegenprepare < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64"
|
||||
target triple = "nvptx64-nvidia-cuda"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -S -codegenprepare -mtriple=powerpc64-unknown-linux-gnu -data-layout="E-m:e-i64:64-n32:64" -force-split-store < %s | FileCheck --check-prefix=BE %s
|
||||
; RUN: opt -S -codegenprepare -mtriple=powerpc64le-unknown-linux-gnu -data-layout="e-m:e-i64:64-n32:64" -force-split-store < %s | FileCheck --check-prefix=LE %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -mtriple=powerpc64-unknown-linux-gnu -data-layout="E-m:e-i64:64-n32:64" -force-split-store < %s | FileCheck --check-prefix=BE %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -mtriple=powerpc64le-unknown-linux-gnu -data-layout="e-m:e-i64:64-n32:64" -force-split-store < %s | FileCheck --check-prefix=LE %s
|
||||
|
||||
define void @split_store_align1(float %x, ptr %p) {
|
||||
; BE-LABEL: @split_store_align1(
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -S -codegenprepare -mtriple=riscv32 %s \
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -mtriple=riscv32 %s \
|
||||
; RUN: | FileCheck --check-prefixes=CHECK,NOZBS %s
|
||||
; RUN: opt -S -codegenprepare -mtriple=riscv32 -mattr=+zbs %s \
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -mtriple=riscv32 -mattr=+zbs %s \
|
||||
; RUN: | FileCheck --check-prefixes=CHECK,ZBS %s
|
||||
; RUN: opt -S -codegenprepare -mtriple=riscv64 %s \
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -mtriple=riscv64 %s \
|
||||
; RUN: | FileCheck --check-prefixes=CHECK,NOZBS %s
|
||||
; RUN: opt -S -codegenprepare -mtriple=riscv64 -mattr=zbs %s \
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -mtriple=riscv64 -mattr=zbs %s \
|
||||
; RUN: | FileCheck --check-prefixes=CHECK,ZBS %s
|
||||
|
||||
@A = global i32 zeroinitializer
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -S -codegenprepare < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s
|
||||
|
||||
target triple = "riscv64-unknown-unknown"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -codegenprepare -S < %s | FileCheck %s
|
||||
; RUN: opt -enable-debugify -codegenprepare -S < %s 2>&1 | FileCheck %s -check-prefix=DEBUG
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -S < %s | FileCheck %s
|
||||
; RUN: opt -enable-debugify -passes='require<profile-summary>,function(codegenprepare)' -S < %s 2>&1 | FileCheck %s -check-prefix=DEBUG
|
||||
|
||||
; Subset of tests from llvm/tests/Transforms/CodeGenPrepare/X86/overflow-intrinsics.ll
|
||||
; to test shouldFormOverflowOp on SPARC, where it is not profitable to create
|
||||
@@ -119,5 +119,5 @@ define i1 @usubo_ult_i64_math_overflow_used(i64 %x, i64 %y, ptr %p) {
|
||||
ret i1 %ov
|
||||
}
|
||||
|
||||
; Check that every instruction inserted by -codegenprepare has a debug location.
|
||||
; Check that every instruction inserted by -passes='require<profile-summary>,function(codegenprepare)' has a debug location.
|
||||
; DEBUG: CheckModuleDebugify: PASS
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; RUN: opt -codegenprepare -S < %s | FileCheck %s
|
||||
; RUN: opt -codegenprepare -S < %s --try-experimental-debuginfo-iterators | FileCheck %s
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -S < %s | FileCheck %s
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -S < %s --try-experimental-debuginfo-iterators | FileCheck %s
|
||||
|
||||
; The following target lines are needed for the test to exercise what it should.
|
||||
; Without these lines, CodeGenPrepare does not try to sink the bitcasts.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -codegenprepare -S %s | FileCheck %s
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -S %s | FileCheck %s
|
||||
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -codegenprepare -S %s | FileCheck %s
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -S %s | FileCheck %s
|
||||
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -codegenprepare -S < %s | FileCheck %s
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -S < %s | FileCheck %s
|
||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -S -codegenprepare < %s | FileCheck %s --check-prefix=SLOW
|
||||
; RUN: opt -S -codegenprepare -mattr=+bmi < %s | FileCheck %s --check-prefix=FAST_TZ
|
||||
; RUN: opt -S -codegenprepare -mattr=+lzcnt < %s | FileCheck %s --check-prefix=FAST_LZ
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s --check-prefix=SLOW
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -mattr=+bmi < %s | FileCheck %s --check-prefix=FAST_TZ
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -mattr=+lzcnt < %s | FileCheck %s --check-prefix=FAST_LZ
|
||||
|
||||
; RUN: opt -S -debugify -codegenprepare < %s | FileCheck %s --check-prefix=DEBUGINFO
|
||||
; RUN: opt -S -debugify -codegenprepare --try-experimental-debuginfo-iterators < %s | FileCheck %s --check-prefix=DEBUGINFO
|
||||
; RUN: opt -S -enable-debugify -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s --check-prefix=DEBUGINFO
|
||||
; RUN: opt -S -enable-debugify -passes='require<profile-summary>,function(codegenprepare)' --try-experimental-debuginfo-iterators < %s | FileCheck %s --check-prefix=DEBUGINFO
|
||||
|
||||
target triple = "x86_64-unknown-unknown"
|
||||
target datalayout = "e-n32:64"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -codegenprepare -S -mtriple=x86_64-linux < %s | FileCheck %s
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -S -mtriple=x86_64-linux < %s | FileCheck %s
|
||||
|
||||
define i32 @test1(ptr %d) nounwind {
|
||||
; CHECK-LABEL: @test1(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -codegenprepare -disable-cgp-branch-opts -S < %s | FileCheck %s
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -disable-cgp-branch-opts -S < %s | FileCheck %s
|
||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -S -codegenprepare < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s
|
||||
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -S -codegenprepare < %s | FileCheck %s
|
||||
; RUN: opt -S -codegenprepare -cgpp-huge-func=0 < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -cgpp-huge-func=0 < %s | FileCheck %s
|
||||
|
||||
target datalayout =
|
||||
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -S -codegenprepare < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s
|
||||
|
||||
target datalayout =
|
||||
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -codegenprepare -S -mtriple=x86_64 < %s | FileCheck %s
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -S -mtriple=x86_64 < %s | FileCheck %s
|
||||
|
||||
@exit_addr = constant ptr blockaddress(@gep_unmerging, %exit)
|
||||
@op1_addr = constant ptr blockaddress(@gep_unmerging, %op1)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -codegenprepare -S -mtriple=x86_64 < %s | FileCheck %s
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -S -mtriple=x86_64 < %s | FileCheck %s
|
||||
|
||||
@tmp = global i8 0
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
|
||||
; RUN: opt -S -codegenprepare < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s
|
||||
; REQUIRES: x86-registered-target
|
||||
target triple = "x86_64-pc-linux"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; RUN: opt -S -codegenprepare < %s | FileCheck %s
|
||||
; RUN: opt -S -codegenprepare -addr-sink-using-gep=false < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -addr-sink-using-gep=false < %s | FileCheck %s
|
||||
|
||||
; This target data layout is modified to have a non-integral addrspace(1),
|
||||
; in order to verify that codegenprepare does not try to introduce illegal
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -S -codegenprepare < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -codegenprepare -S < %s | FileCheck %s
|
||||
; RUN: opt -enable-debugify -codegenprepare -S < %s 2>&1 | FileCheck %s -check-prefix=DEBUG
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -S < %s | FileCheck %s
|
||||
; RUN: opt -enable-debugify -passes='require<profile-summary>,function(codegenprepare)' -S < %s 2>&1 | FileCheck %s -check-prefix=DEBUG
|
||||
|
||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
|
||||
target triple = "x86_64-apple-darwin10.0.0"
|
||||
@@ -636,6 +636,6 @@ exit:
|
||||
ret void
|
||||
}
|
||||
|
||||
; Check that every instruction inserted by -codegenprepare has a debug location.
|
||||
; Check that every instruction inserted by -passes='require<profile-summary>,function(codegenprepare)' has a debug location.
|
||||
; DEBUG: CheckModuleDebugify: PASS
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -S -codegenprepare < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s
|
||||
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-pc-windows-msvc"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -S -codegenprepare -disable-complex-addr-modes=false -addr-sink-new-phis=true -addr-sink-new-select=true %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -disable-complex-addr-modes=false -addr-sink-new-phis=true -addr-sink-new-select=true %s | FileCheck %s
|
||||
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
|
||||
; RUN: opt -S -codegenprepare -mtriple=x86_64-unknown-unknown < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -mtriple=x86_64-unknown-unknown < %s | FileCheck %s
|
||||
|
||||
; Make sure the nneg flag is dropped when lshr and zext are interchanged.
|
||||
define i8 @get(ptr %box, i32 %in) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -codegenprepare -S -mtriple=x86_64-linux < %s | FileCheck %s
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -S -mtriple=x86_64-linux < %s | FileCheck %s
|
||||
|
||||
declare void @llvm.assume(i1 noundef) nounwind willreturn
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -S -codegenprepare -mtriple=x86_64-linux < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -mtriple=x86_64-linux < %s | FileCheck %s
|
||||
;
|
||||
; Ensure that blocks that only contain @llvm.assume are removed completely
|
||||
; during CodeGenPrepare.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -codegenprepare -S < %s | FileCheck %s
|
||||
; RUN: opt -debugify -codegenprepare -S < %s | FileCheck %s -check-prefix=DEBUG
|
||||
; RUN: opt -debugify -codegenprepare -S < %s --try-experimental-debuginfo-iterators | FileCheck %s -check-prefix=DEBUG
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -S < %s | FileCheck %s
|
||||
; RUN: opt -enable-debugify -passes='require<profile-summary>,function(codegenprepare)' -S < %s | FileCheck %s -check-prefix=DEBUG
|
||||
; RUN: opt -enable-debugify -passes='require<profile-summary>,function(codegenprepare)' -S < %s --try-experimental-debuginfo-iterators | FileCheck %s -check-prefix=DEBUG
|
||||
|
||||
target triple = "x86_64-unknown-unknown"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; RUN: opt -S -codegenprepare -disable-complex-addr-modes=false -addr-sink-new-phis=true -addr-sink-new-select=true -disable-cgp-delete-phis %s | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-YES
|
||||
; RUN: opt -S -codegenprepare -disable-complex-addr-modes=false -addr-sink-new-phis=false -addr-sink-new-select=true -disable-cgp-delete-phis %s | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NO
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -disable-complex-addr-modes=false -addr-sink-new-phis=true -addr-sink-new-select=true -disable-cgp-delete-phis %s | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-YES
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -disable-complex-addr-modes=false -addr-sink-new-phis=false -addr-sink-new-select=true -disable-cgp-delete-phis %s | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NO
|
||||
target datalayout =
|
||||
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -S -codegenprepare < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s
|
||||
|
||||
target datalayout =
|
||||
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -S -codegenprepare -disable-complex-addr-modes=false -addr-sink-new-select=true %s | FileCheck %s --check-prefix=CHECK
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -disable-complex-addr-modes=false -addr-sink-new-select=true %s | FileCheck %s --check-prefix=CHECK
|
||||
target datalayout =
|
||||
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -S -codegenprepare -disable-complex-addr-modes=false -disable-cgp-delete-phis %s | FileCheck %s --check-prefix=CHECK
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -disable-complex-addr-modes=false -disable-cgp-delete-phis %s | FileCheck %s --check-prefix=CHECK
|
||||
target datalayout =
|
||||
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -S -codegenprepare < %s | FileCheck %s
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s
|
||||
|
||||
target datalayout =
|
||||
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -S -codegenprepare < %s | FileCheck %s -check-prefix=CHECK -check-prefix=GEP
|
||||
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s -check-prefix=CHECK -check-prefix=GEP
|
||||
|
||||
target datalayout =
|
||||
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -codegenprepare -S -mtriple=x86_64 < %s | FileCheck %s
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -S -mtriple=x86_64 < %s | FileCheck %s
|
||||
|
||||
; Test that an invalid CFG is not created by splitIndirectCriticalEdges
|
||||
; transformation when the 'target' block is a loop to itself.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -codegenprepare -mtriple=x86_64-unknown-unknown -force-split-store -S < %s | FileCheck %s
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -mtriple=x86_64-unknown-unknown -force-split-store -S < %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:32-n8:16:32-a:0:32-S32"
|
||||
target triple = "i686-w64-windows-gnu"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; RUN: opt -codegenprepare -S < %s | FileCheck %s
|
||||
; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -S < %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-pc-linux-gnu"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user