Remove unneeded preservation and restore of ValueMap and ClastVars in GPGPU code
authorTobias Grosser <grosser@fim.uni-passau.de>
Fri, 30 Nov 2012 01:05:05 +0000 (01:05 +0000)
committerTobias Grosser <grosser@fim.uni-passau.de>
Fri, 30 Nov 2012 01:05:05 +0000 (01:05 +0000)
generation.

We don't use the exact same way to build loop body for GPGPU codegen as openmp
codegen and other transformations do currently, in which cases 'createLoop'
function is called recursively. GPGPU codegen may fail due to improper restore
of ValueMap and ClastVars .

Contributed by:  Yabin Hu <yabin.hwu@gmail.com>

llvm-svn: 168966

polly/lib/CodeGen/CodeGeneration.cpp

index 84289ed..064c828 100644 (file)
@@ -714,17 +714,10 @@ void ClastStmtCodeGen::codegenForGPGPU(const clast_for *F) {
     VMap.insert(std::make_pair<Value*, Value*>(OldIV, IV));
   }
 
-  // Preserve the current values.
-  const ValueMapT ValueMapCopy = ValueMap;
-  const CharMapT ClastVarsCopy = ClastVars;
-  updateWithVMap(VMap);
+  updateWithValueMap(VMap);
 
   BlockGenerator::generate(Builder, *Statement, ValueMap, P);
 
-  // Restore the original values.
-  ValueMap = ValueMapCopy;
-  ClastVars = ClastVarsCopy;
-
   if (AfterBB)
     Builder.SetInsertPoint(AfterBB->begin());