BlockGenerator: Drop unneeded const_casts
llvm-svn: 255505
This commit is contained in:
parent
f727e387be
commit
6f764bbd9c
|
@ -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!");
|
||||
|
|
Loading…
Reference in New Issue