forked from OSchip/llvm-project
Remove dead code
This code has been replaced by the SCEVValidator a while ago. llvm-svn: 163471
This commit is contained in:
parent
78ddd58743
commit
6eaafb7288
|
@ -43,11 +43,6 @@ namespace polly {
|
|||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Functions for checking affine functions.
|
||||
bool isInvariant(const llvm::SCEV *S, llvm::Region &R);
|
||||
|
||||
bool isParameter(const llvm::SCEV *Var, llvm::Region &RefRegion,
|
||||
llvm::LoopInfo &LI, llvm::ScalarEvolution &SE);
|
||||
|
||||
bool isIndVar(const llvm::SCEV *Var, llvm::Region &RefRegion,
|
||||
llvm::LoopInfo &LI, llvm::ScalarEvolution &SE);
|
||||
|
||||
|
|
|
@ -25,96 +25,6 @@
|
|||
|
||||
using namespace llvm;
|
||||
|
||||
|
||||
namespace {
|
||||
// Checks if a SCEV is invariant in a region. This is if all Values are
|
||||
// referenced in this SCEV are defined outside the region.
|
||||
class InvariantChecker: SCEVVisitor<InvariantChecker, bool> {
|
||||
Region &R;
|
||||
|
||||
public:
|
||||
bool visitConstant(const SCEVConstant *S) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool visitUnknown(const SCEVUnknown *S) {
|
||||
Value *V = S->getValue();
|
||||
|
||||
// An Instruction defined outside the region is invariant.
|
||||
if (Instruction *I = dyn_cast<Instruction>(V))
|
||||
return !R.contains(I);
|
||||
|
||||
// A constant is invariant.
|
||||
return true;
|
||||
}
|
||||
|
||||
bool visitNAryExpr(const SCEVNAryExpr *S) {
|
||||
for (SCEVNAryExpr::op_iterator OI = S->op_begin(), OE = S->op_end();
|
||||
OI != OE; ++OI)
|
||||
if (!visit(*OI))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool visitMulExpr(const SCEVMulExpr *S) {
|
||||
return visitNAryExpr(S);
|
||||
}
|
||||
|
||||
bool visitCastExpr(const SCEVCastExpr *S) {
|
||||
return visit(S->getOperand());
|
||||
}
|
||||
|
||||
bool visitTruncateExpr(const SCEVTruncateExpr *S) {
|
||||
return visit(S->getOperand());
|
||||
}
|
||||
|
||||
bool visitZeroExtendExpr(const SCEVZeroExtendExpr *S) {
|
||||
return visit(S->getOperand());
|
||||
}
|
||||
|
||||
bool visitSignExtendExpr(const SCEVSignExtendExpr *S) {
|
||||
return visit(S->getOperand());
|
||||
}
|
||||
|
||||
bool visitAddExpr(const SCEVAddExpr *S) {
|
||||
return visitNAryExpr(S);
|
||||
}
|
||||
|
||||
bool visitAddRecExpr(const SCEVAddRecExpr *S) {
|
||||
// Check if the addrec is contained in the region.
|
||||
if (R.contains(S->getLoop()))
|
||||
return false;
|
||||
|
||||
return visitNAryExpr(S);
|
||||
}
|
||||
|
||||
bool visitUDivExpr(const SCEVUDivExpr *S) {
|
||||
return visit(S->getLHS()) && visit(S->getRHS());
|
||||
}
|
||||
|
||||
bool visitSMaxExpr(const SCEVSMaxExpr *S) {
|
||||
return visitNAryExpr(S);
|
||||
}
|
||||
|
||||
bool visitUMaxExpr(const SCEVUMaxExpr *S) {
|
||||
return visitNAryExpr(S);
|
||||
}
|
||||
|
||||
bool visitCouldNotCompute(const SCEVCouldNotCompute *S) {
|
||||
llvm_unreachable("SCEV cannot be checked");
|
||||
}
|
||||
|
||||
InvariantChecker(Region &RefRegion)
|
||||
: R(RefRegion) {}
|
||||
|
||||
static bool isInvariantInRegion(const SCEV *S, Region &R) {
|
||||
InvariantChecker Checker(R);
|
||||
return Checker.visit(S);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Helper function for Scop
|
||||
// TODO: Add assertion to not allow parameter to be null
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -157,38 +67,6 @@ Value *polly::getPointerOperand(Instruction &Inst) {
|
|||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Helper functions
|
||||
|
||||
bool polly::isInvariant(const SCEV *S, Region &R) {
|
||||
return InvariantChecker::isInvariantInRegion(S, R);
|
||||
}
|
||||
|
||||
// Helper function to check parameter
|
||||
bool polly::isParameter(const SCEV *Var, Region &RefRegion,
|
||||
LoopInfo &LI, ScalarEvolution &SE) {
|
||||
assert(Var && "Var can not be null!");
|
||||
|
||||
if (!isInvariant(Var, RefRegion))
|
||||
return false;
|
||||
|
||||
if (isa<SCEVAddRecExpr>(Var))
|
||||
return true;
|
||||
|
||||
if (const SCEVUnknown *U = dyn_cast<SCEVUnknown>(Var)) {
|
||||
if (isa<PHINode>(U->getValue()))
|
||||
return false;
|
||||
|
||||
if(isa<UndefValue>(U->getValue()))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (const SCEVCastExpr *Cast = dyn_cast<SCEVCastExpr>(Var))
|
||||
return isParameter(Cast->getOperand(), RefRegion, LI, SE);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool polly::isIndVar(const SCEV *Var, Region &RefRegion,
|
||||
LoopInfo &LI, ScalarEvolution &SE) {
|
||||
const SCEVAddRecExpr *AddRec = dyn_cast<SCEVAddRecExpr>(Var);
|
||||
|
|
Loading…
Reference in New Issue