Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
//===-- PPCTargetTransformInfo.cpp - PPC specific TTI ---------------------===// | //===-- PPCTargetTransformInfo.cpp - PPC specific TTI ---------------------===// | ||||
// | // | ||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||||
// See https://llvm.org/LICENSE.txt for license information. | // See https://llvm.org/LICENSE.txt for license information. | ||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||||
// | // | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
#include "PPCTargetTransformInfo.h" | #include "PPCTargetTransformInfo.h" | ||||
#include "llvm/Analysis/CFG.h" | |||||
#include "llvm/Analysis/CodeMetrics.h" | #include "llvm/Analysis/CodeMetrics.h" | ||||
#include "llvm/Analysis/TargetTransformInfo.h" | #include "llvm/Analysis/TargetTransformInfo.h" | ||||
#include "llvm/CodeGen/BasicTTIImpl.h" | #include "llvm/CodeGen/BasicTTIImpl.h" | ||||
#include "llvm/CodeGen/CostTable.h" | #include "llvm/CodeGen/CostTable.h" | ||||
#include "llvm/CodeGen/TargetLowering.h" | #include "llvm/CodeGen/TargetLowering.h" | ||||
#include "llvm/CodeGen/TargetSchedule.h" | #include "llvm/CodeGen/TargetSchedule.h" | ||||
#include "llvm/Support/CommandLine.h" | #include "llvm/Support/CommandLine.h" | ||||
#include "llvm/Support/Debug.h" | #include "llvm/Support/Debug.h" | ||||
#include "llvm/Analysis/LoopIterator.h" | |||||
using namespace llvm; | using namespace llvm; | ||||
#define DEBUG_TYPE "ppctti" | #define DEBUG_TYPE "ppctti" | ||||
static cl::opt<bool> DisablePPCConstHoist("disable-ppc-constant-hoisting", | static cl::opt<bool> DisablePPCConstHoist("disable-ppc-constant-hoisting", | ||||
cl::desc("disable constant hoisting on PPC"), cl::init(false), cl::Hidden); | cl::desc("disable constant hoisting on PPC"), cl::init(false), cl::Hidden); | ||||
// This is currently only used for the data prefetch pass which is only enabled | // This is currently only used for the data prefetch pass which is only enabled | ||||
▲ Show 20 Lines • Show All 849 Lines • ▼ Show 20 Lines | int PPCTTIImpl::getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy, | ||||
// instruction). For each result vector, we need one shuffle per incoming | // instruction). For each result vector, we need one shuffle per incoming | ||||
// vector (except that the first shuffle can take two incoming vectors | // vector (except that the first shuffle can take two incoming vectors | ||||
// because it does not need to take itself). | // because it does not need to take itself). | ||||
Cost += Factor*(LT.first-1); | Cost += Factor*(LT.first-1); | ||||
return Cost; | return Cost; | ||||
} | } | ||||
bool PPCTTIImpl::canSaveCmp(Loop *L, BranchInst **BI, ScalarEvolution *SE, | |||||
LoopInfo *LI, DominatorTree *DT, | |||||
AssumptionCache *AC, TargetLibraryInfo *LibInfo) { | |||||
// Process nested loops first. | |||||
for (Loop::iterator I = L->begin(), E = L->end(); I != E; ++I) | |||||
if (canSaveCmp(*I, BI, SE, LI, DT, AC, LibInfo)) | |||||
return false; // Stop search. | |||||
// Bail out if the loop has irreducible control flow. | |||||
hfinkel: This is duplicating applicibility logic from the HardwareLoops pass? Can we move this into a… | |||||
LoopBlocksRPO RPOT(L); | |||||
RPOT.perform(LI); | |||||
if (containsIrreducibleCFG<const BasicBlock *>(RPOT, *LI)) | |||||
return false; | |||||
HardwareLoopInfo HWLoopInfo(L); | |||||
if (!isHardwareLoopProfitable(L, *SE, *AC, LibInfo, HWLoopInfo)) | |||||
return false; | |||||
if (!HWLoopInfo.isHardwareLoopCandidate(*SE, *LI, *DT)) | |||||
return false; | |||||
*BI = HWLoopInfo.ExitBranch; | |||||
return true; | |||||
} |
This is duplicating applicibility logic from the HardwareLoops pass? Can we move this into a utility function, maybe something like HardwareLoopInfo::canAnalyze(Loop *L)?