[polly] r250628 - BlockGenerator: Add getOrCreateAlloca(const ScopArrayInfo *Array)

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 17 15:16:00 PDT 2015


Author: grosser
Date: Sat Oct 17 17:16:00 2015
New Revision: 250628

URL: http://llvm.org/viewvc/llvm-project?rev=250628&view=rev
Log:
BlockGenerator: Add getOrCreateAlloca(const ScopArrayInfo *Array)

This allows the caller to get the alloca locations of an array without the
need to thank if Array is a PHI or a non-PHI Array. We directly make use of this
in BlockGenerator::getOrCreateAlloca(MemoryAccess &Access).

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

Modified: polly/trunk/include/polly/CodeGen/BlockGenerators.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/BlockGenerators.h?rev=250628&r1=250627&r2=250628&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/BlockGenerators.h (original)
+++ polly/trunk/include/polly/CodeGen/BlockGenerators.h Sat Oct 17 17:16:00 2015
@@ -35,6 +35,7 @@ namespace polly {
 using namespace llvm;
 class ScopStmt;
 class MemoryAccess;
+class ScopArrayInfo;
 class IslExprBuilder;
 
 /// @brief Generate a new basic block for a polyhedral statement.
@@ -130,6 +131,16 @@ public:
   ///          GlobalMap.
   Value *getOrCreateAlloca(MemoryAccess &Access);
 
+  /// @brief Return the alloca for @p Array
+  ///
+  /// If no alloca was mapped for @p Array a new one is created.
+  ///
+  /// @param Array The array for which to generate the alloca
+  ///
+  /// @returns The alloca for @p Array or a replacement value taken from
+  ///          GlobalMap.
+  Value *getOrCreateAlloca(const ScopArrayInfo *Array);
+
   /// @brief Finalize the code generation for the SCoP @p S.
   ///
   /// This will initialize and finalize the scalar variables we demoted during

Modified: polly/trunk/lib/CodeGen/BlockGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/BlockGenerators.cpp?rev=250628&r1=250627&r2=250628&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/BlockGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/BlockGenerators.cpp Sat Oct 17 17:16:00 2015
@@ -332,10 +332,14 @@ Value *BlockGenerator::getOrCreateAlloca
 }
 
 Value *BlockGenerator::getOrCreateAlloca(MemoryAccess &Access) {
-  if (Access.getScopArrayInfo()->isPHI())
-    return getOrCreatePHIAlloca(Access.getBaseAddr());
+  return getOrCreateAlloca(Access.getScopArrayInfo());
+}
+
+Value *BlockGenerator::getOrCreateAlloca(const ScopArrayInfo *Array) {
+  if (Array->isPHI())
+    return getOrCreatePHIAlloca(Array->getBasePtr());
   else
-    return getOrCreateScalarAlloca(Access.getBaseAddr());
+    return getOrCreateScalarAlloca(Array->getBasePtr());
 }
 
 Value *BlockGenerator::getOrCreateScalarAlloca(Value *ScalarBase) {




More information about the llvm-commits mailing list