[PATCH] D106625: [Attributor][FIX] checkForAllInstructions, correctly handle declered functions

Kuter Dinel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 23 16:23:30 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0cd964ff2548: [Attributor][FIX] checkForAllInstructions, correctly handle declarations (authored by kuter).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106625/new/

https://reviews.llvm.org/D106625

Files:
  llvm/lib/Transforms/IPO/Attributor.cpp
  llvm/unittests/Transforms/IPO/AttributorTest.cpp


Index: llvm/unittests/Transforms/IPO/AttributorTest.cpp
===================================================================
--- llvm/unittests/Transforms/IPO/AttributorTest.cpp
+++ llvm/unittests/Transforms/IPO/AttributorTest.cpp
@@ -75,8 +75,16 @@
 
 TEST_F(AttributorTestBase, AAReachabilityTest) {
   const char *ModuleString = R"(
-    declare void @func4()
-    declare void @func3()
+    @x = global i32 0
+    define void @func4() {
+      store i32 0, i32* @x
+      ret void
+    }
+
+    define void @func3() {
+      store i32 0, i32* @x
+      ret void
+    }
 
     define void @func2() {
     entry:
Index: llvm/lib/Transforms/IPO/Attributor.cpp
===================================================================
--- llvm/lib/Transforms/IPO/Attributor.cpp
+++ llvm/lib/Transforms/IPO/Attributor.cpp
@@ -1146,6 +1146,9 @@
   if (!AssociatedFunction)
     return false;
 
+  if (AssociatedFunction->isDeclaration())
+    return false;
+
   // TODO: use the function scope once we have call site AAReturnedValues.
   const IRPosition &QueryIRP = IRPosition::function(*AssociatedFunction);
   const auto *LivenessAA =


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106625.361377.patch
Type: text/x-patch
Size: 1129 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210723/6d0ecba2/attachment.bin>


More information about the llvm-commits mailing list