BlockGenerator: Use AssertingVH in maps

By using asserting value handles, we will get assertions when we forget to clear
any of the Value maps instead of difficult to debug undefined behavior.

llvm-svn: 249237
diff --git a/polly/lib/CodeGen/BlockGenerators.cpp b/polly/lib/CodeGen/BlockGenerators.cpp
index 5cec72c..c282fa5 100644
--- a/polly/lib/CodeGen/BlockGenerators.cpp
+++ b/polly/lib/CodeGen/BlockGenerators.cpp
@@ -362,18 +362,17 @@
 Value *BlockGenerator::getOrCreateAlloca(Value *ScalarBase,
                                          ScalarAllocaMapTy &Map,
                                          const char *NameExt) {
-  // Check if an alloca was cached for the base instruction.
-  Value *&Addr = Map[ScalarBase];
-
   // If no alloca was found create one and insert it in the entry block.
-  if (!Addr) {
+  if (!Map.count(ScalarBase)) {
     auto *Ty = ScalarBase->getType();
     auto NewAddr = new AllocaInst(Ty, ScalarBase->getName() + NameExt);
     EntryBB = &Builder.GetInsertBlock()->getParent()->getEntryBlock();
     NewAddr->insertBefore(EntryBB->getFirstInsertionPt());
-    Addr = NewAddr;
+    Map[ScalarBase] = NewAddr;
   }
 
+  auto Addr = Map[ScalarBase];
+
   if (GlobalMap.count(Addr))
     return GlobalMap[Addr];