[polly] r249239 - IslExprBuilder: Use AssertingVH for IdToValueTy

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 3 10:20:00 PDT 2015


Author: grosser
Date: Sat Oct  3 12:20:00 2015
New Revision: 249239

URL: http://llvm.org/viewvc/llvm-project?rev=249239&view=rev
Log:
IslExprBuilder: Use AssertingVH for IdToValueTy

Modified:
    polly/trunk/include/polly/CodeGen/IslExprBuilder.h
    polly/trunk/lib/CodeGen/IslNodeBuilder.cpp

Modified: polly/trunk/include/polly/CodeGen/IslExprBuilder.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/IslExprBuilder.h?rev=249239&r1=249238&r2=249239&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/IslExprBuilder.h (original)
+++ polly/trunk/include/polly/CodeGen/IslExprBuilder.h Sat Oct  3 12:20:00 2015
@@ -80,7 +80,7 @@ namespace polly {
 class IslExprBuilder {
 public:
   /// @brief A map from isl_ids to llvm::Values.
-  typedef llvm::MapVector<isl_id *, llvm::Value *> IDToValueTy;
+  typedef llvm::MapVector<isl_id *, llvm::AssertingVH<llvm::Value>> IDToValueTy;
   typedef llvm::DenseMap<const llvm::Value *, llvm::Value *> ValueToValueMap;
 
   /// @brief Construct an IslExprBuilder.

Modified: polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslNodeBuilder.cpp?rev=249239&r1=249238&r2=249239&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslNodeBuilder.cpp (original)
+++ polly/trunk/lib/CodeGen/IslNodeBuilder.cpp Sat Oct  3 12:20:00 2015
@@ -817,11 +817,11 @@ void IslNodeBuilder::create(__isl_take i
 }
 
 void IslNodeBuilder::materializeValue(isl_id *Id) {
-  Value *&V = IDToValue[Id];
-
   // If the Id is already mapped, skip it.
-  if (!V)
-    V = generateSCEV((const SCEV *)isl_id_get_user(Id));
+  if (!IDToValue.count(Id)) {
+    auto V = generateSCEV((const SCEV *)isl_id_get_user(Id));
+    IDToValue[Id] = V;
+  }
 
   isl_id_free(Id);
 }




More information about the llvm-commits mailing list