[PATCH] D33688: [Polly] Heap allocation for new arrays

Andreas Simbuerger via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 07:48:16 PDT 2017


simbuerg added a comment.

We're getting close IMHO. I will commit the small range-check patch tonight.



================
Comment at: lib/Exchange/JSONExporter.cpp:709
+      if (Size <= 0) {
+        errs() << "The size at index " << i << " is =< 0.\n";
+        return false;
----------------
Meinersbur wrote:
> The additional range check could be committed separately, it look unrelated.
> (Andreas can just commit it with its test case)
I will tonight.


================
Comment at: lib/Exchange/JSONExporter.cpp:723
+      }
+    }
   }
----------------
You don't need to redirect from CString to StringRef for a simple string comparison.

Try:

```
for (; ArrayIdx < Arrays.size(0; ArrayIdx++) {
  auto &Array = Arrays[ArrayIdx];
  ... (Replace usage of Arrays[ArrayIdx] with Array ...
  if (Array.isMember("allocation") {
    NewSAI->setIsOnHeap(Array["allocation"].asString() == "heap");
  }
```


https://reviews.llvm.org/D33688





More information about the llvm-commits mailing list