[PATCH] D33839: Prevent outlining of basicblock that uses BlockAddress

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 26 09:32:31 PDT 2017


davidxl added inline comments.


================
Comment at: ../lib/Transforms/Utils/CodeExtractor.cpp:75
+
+  // loop
+  while (!ToVisit.empty()) {
----------------
Remove this comment.


================
Comment at: ../lib/Transforms/Utils/CodeExtractor.cpp:80
+      continue;
+    Visited.insert(Curr);
+    if (isa<BlockAddress const>(Curr)) {
----------------
Can you combine insert and count call, i.e, check the second member of the returned pair of 'insert'?


================
Comment at: ../lib/Transforms/Utils/CodeExtractor.cpp:81
+    Visited.insert(Curr);
+    if (isa<BlockAddress const>(Curr)) {
+      return true; // even a reference to self is likely to be not compatible
----------------
Remove braces.


================
Comment at: ../lib/Transforms/Utils/CodeExtractor.cpp:82
+    if (isa<BlockAddress const>(Curr)) {
+      return true; // even a reference to self is likely to be not compatible
+    }
----------------
return false?


================
Comment at: ../lib/Transforms/Utils/CodeExtractor.cpp:84
+    }
+    for (auto const &U : Curr->operands()) {
+      if (auto *UU = dyn_cast<User>(U))
----------------
You don't need to check the operands of instructions not in the BB set to be extracted. Guard this with

if (Curr->getParent() == &BB)


================
Comment at: ../test/Transforms/CodeExtractor/BlockAddressreference.ll:1
+; RUN: opt < %s -loop-extract -S | FileCheck %s
+
----------------
Need a test case covering use of block address in extracted region.


Repository:
  rL LLVM

https://reviews.llvm.org/D33839





More information about the llvm-commits mailing list