[polly] r255505 - BlockGenerator: Drop unneeded const_casts

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 14 08:19:55 PST 2015


Author: grosser
Date: Mon Dec 14 10:19:54 2015
New Revision: 255505

URL: http://llvm.org/viewvc/llvm-project?rev=255505&view=rev
Log:
BlockGenerator: Drop unneeded const_casts

Modified:
    polly/trunk/lib/CodeGen/BlockGenerators.cpp

Modified: polly/trunk/lib/CodeGen/BlockGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/BlockGenerators.cpp?rev=255505&r1=255504&r2=255505&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/BlockGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/BlockGenerators.cpp Mon Dec 14 10:19:54 2015
@@ -94,7 +94,7 @@ Value *BlockGenerator::getNewValue(ScopS
   // 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(ScopS
 
   // 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!");




More information about the llvm-commits mailing list