Skip to content

Commit 96da6dd

Browse files
committed
[Attributor][FIX] Only avoid visiting PHI uses multiple times (PR51249)
AAPointerInfoFloating needs to visit all uses and some multiple times if we go through PHI nodes. Attributor::checkForAllUses keeps a visited set so we don't recurs endlessly. We now allow recursion for non-phi uses so we track all pointer offsets via PHI nodes properly without endless recursion. This replaces the first attempt D107579. Differential Revision: https://reviews.llvm.org/D107798
1 parent f358727 commit 96da6dd

File tree

2 files changed

+56
-45
lines changed

2 files changed

+56
-45
lines changed

llvm/lib/Transforms/IPO/Attributor.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "llvm/IR/GlobalVariable.h"
3333
#include "llvm/IR/IRBuilder.h"
3434
#include "llvm/IR/Instruction.h"
35+
#include "llvm/IR/Instructions.h"
3536
#include "llvm/IR/IntrinsicInst.h"
3637
#include "llvm/IR/NoFolder.h"
3738
#include "llvm/IR/ValueHandle.h"
@@ -1023,7 +1024,7 @@ bool Attributor::checkForAllUses(function_ref<bool(const Use &, bool &)> Pred,
10231024

10241025
while (!Worklist.empty()) {
10251026
const Use *U = Worklist.pop_back_val();
1026-
if (!Visited.insert(U).second)
1027+
if (isa<PHINode>(U->getUser()) && !Visited.insert(U).second)
10271028
continue;
10281029
LLVM_DEBUG(dbgs() << "[Attributor] Check use: " << **U << " in "
10291030
<< *U->getUser() << "\n");

0 commit comments

Comments
 (0)