BlockGenerator: Drop unneeded const_casts

llvm-svn: 255505
This commit is contained in:
Tobias Grosser 2015-12-14 16:19:54 +00:00
parent f727e387be
commit 6f764bbd9c
1 changed files with 3 additions and 3 deletions

View File

@ -94,7 +94,7 @@ Value *BlockGenerator::getNewValue(ScopStmt &Stmt, Value *Old, ValueMapT &BBMap,
// We assume constants never change.
// This avoids map lookups for many calls to this function.
if (isa<Constant>(Old))
return const_cast<Value *>(Old);
return Old;
if (Value *New = GlobalMap.lookup(Old)) {
if (Value *NewRemapped = GlobalMap.lookup(New))
@ -114,12 +114,12 @@ Value *BlockGenerator::getNewValue(ScopStmt &Stmt, Value *Old, ValueMapT &BBMap,
// A scop-constant value defined by a global or a function parameter.
if (isa<GlobalValue>(Old) || isa<Argument>(Old))
return const_cast<Value *>(Old);
return Old;
// A scop-constant value defined by an instruction executed outside the scop.
if (const Instruction *Inst = dyn_cast<Instruction>(Old))
if (!Stmt.getParent()->getRegion().contains(Inst->getParent()))
return const_cast<Value *>(Old);
return Old;
// The scalar dependence is neither available nor SCEVCodegenable.
llvm_unreachable("Unexpected scalar dependence in region!");