1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

[Attributor][FIX] checkForAllInstructions, correctly handle declarations

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
This commit is contained in:
Kuter Dinel 2021-07-22 06:19:07 +03:00
parent eb8efed47c
commit bb892cf39f
2 changed files with 13 additions and 2 deletions

View File

@ -1146,6 +1146,9 @@ bool Attributor::checkForAllInstructions(function_ref<bool(Instruction &)> Pred,
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 =

View File

@ -75,8 +75,16 @@ TEST_F(AttributorTestBase, TestCast) {
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: