[PATCH] D106625: [Attributor][FIX] checkForAllInstructions, correctly handle declered functions
Kuter Dinel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 22 18:07:25 PDT 2021
kuter created this revision.
Herald added subscribers: ormris, okura, uenoku, hiraditya.
Herald added a reviewer: uenoku.
Herald added a reviewer: homerdin.
kuter requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: sstefan1.
Herald added a reviewer: baziotis.
Herald added subscribers: llvm-commits, bbn.
Herald added a project: LLVM.
checkForAllInstructions was not handling declared functions correctly.
It should have been returning false when it gets called on a declared function.
The patch also fixes a test case for AAFunctionReachability for it to be able
to pass after the changes to the checkForAllinstructions.
Repository:
rG LLVM Github Monorepo
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
@@ -1101,6 +1101,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.361052.patch
Type: text/x-patch
Size: 1129 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210723/ad28c6c1/attachment.bin>
More information about the llvm-commits
mailing list