checkForAllInstructions was not handling declarations correctly.
It should have been returning false when it gets called on a declaration
The patch also fixes a test case for AAFunctionReachability for it to be able
to pass after the changes to the checkForAllinstructions.
Differential Revision: https://reviews.llvm.org/D106625
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 =
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: