[PATCH] D12472: Remove isNew from getOrCreateAlloca

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 30 08:05:11 PDT 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL246383: Remove isNew from getOrCreateAlloca (authored by grosser).

Changed prior to commit:
  http://reviews.llvm.org/D12472?vs=33521&id=33539#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D12472

Files:
  polly/trunk/include/polly/CodeGen/BlockGenerators.h
  polly/trunk/lib/CodeGen/BlockGenerators.cpp

Index: polly/trunk/include/polly/CodeGen/BlockGenerators.h
===================================================================
--- polly/trunk/include/polly/CodeGen/BlockGenerators.h
+++ polly/trunk/include/polly/CodeGen/BlockGenerators.h
@@ -348,12 +348,10 @@
   /// @param ScalarBase The demoted scalar value.
   /// @param Map        The map we should look for a mapped alloca value.
   /// @param NameExt    The suffix we add to the name of a new created alloca.
-  /// @param IsNew      If set it will hold true iff the alloca was created.
   ///
   /// @returns The alloca for @p ScalarBase in @p Map.
   AllocaInst *getOrCreateAlloca(Value *ScalarBase, ScalarAllocaMapTy &Map,
-                                const char *NameExt = ".s2a",
-                                bool *IsNew = nullptr);
+                                const char *NameExt);
 
   /// @brief Generate reload of scalars demoted to memory and needed by @p Inst.
   ///
Index: polly/trunk/lib/CodeGen/BlockGenerators.cpp
===================================================================
--- polly/trunk/lib/CodeGen/BlockGenerators.cpp
+++ polly/trunk/lib/CodeGen/BlockGenerators.cpp
@@ -342,16 +342,10 @@
 
 AllocaInst *BlockGenerator::getOrCreateAlloca(Value *ScalarBase,
                                               ScalarAllocaMapTy &Map,
-                                              const char *NameExt,
-                                              bool *IsNew) {
-
+                                              const char *NameExt) {
   // Check if an alloca was cached for the base instruction.
   AllocaInst *&Addr = Map[ScalarBase];
 
-  // If needed indicate if it was found already or will be created.
-  if (IsNew)
-    *IsNew = (Addr == nullptr);
-
   // If no alloca was found create one and insert it in the entry block.
   if (!Addr) {
     auto *Ty = ScalarBase->getType();
@@ -379,11 +373,9 @@
 
 void BlockGenerator::handleOutsideUsers(const Region &R, Instruction *Inst,
                                         Value *InstCopy) {
-  // If there are escape users we get the alloca for this instruction and put
-  // it in the EscapeMap for later finalization. However, if the alloca was not
-  // created by an already handled scalar dependence we have to initialize it
-  // also. Lastly, if the instruction was copied multiple times we already did
-  // this and can exit.
+  // If there are escape users we get the alloca for this instruction and put it
+  // in the EscapeMap for later finalization. Lastly, if the instruction was
+  // copied multiple times we already did this and can exit.
   if (EscapeMap.count(Inst))
     return;
 
@@ -406,19 +398,10 @@
     return;
 
   // Get or create an escape alloca for this instruction.
-  bool IsNew;
-  AllocaInst *ScalarAddr =
-      getOrCreateAlloca(Inst, ScalarMap, ".escape", &IsNew);
+  AllocaInst *ScalarAddr = getOrCreateScalarAlloca(Inst);
 
   // Remember that this instruction has escape uses and the escape alloca.
   EscapeMap[Inst] = std::make_pair(ScalarAddr, std::move(EscapeUsers));
-
-  // If the escape alloca was just created store the instruction in there,
-  // otherwise that happened already.
-  if (IsNew) {
-    assert(InstCopy && "Except PHIs every instruction should have a copy!");
-    Builder.CreateStore(InstCopy, ScalarAddr);
-  }
 }
 
 void BlockGenerator::generateScalarLoads(ScopStmt &Stmt,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12472.33539.patch
Type: text/x-patch
Size: 3388 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150830/a64b2a00/attachment.bin>


More information about the llvm-commits mailing list