mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-21 18:22:53 +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:
parent
eb8efed47c
commit
bb892cf39f
@ -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 =
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user