[llvm] [Attributor] Prevent infinite loop in AAGlobalValueInfoFloating (PR #94941)

Ethan Luis McDonough via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 11 00:56:48 PDT 2024


================
@@ -1749,6 +1749,10 @@ bool Attributor::checkForAllCallees(
   return Pred(Callees.getArrayRef());
 }
 
+bool noRevisitUser(const User *user) {
+  return isa<PHINode>(user) || !isa<Instruction>(user);
----------------
EthanLuisMcDonough wrote:

I tried this locally, and it seems to break a lot of tests. Not sure exactly why this fails, but I suspect it might be caused by the `checkForAllCallSites` call also using the `AddUsers` closure. I think we should just keep the check in the worklist loop for now.

```cpp
if (!noRevisitUser(UU.getUser()))
  Worklist.push_back(&UU);
```

https://github.com/llvm/llvm-project/pull/94941


More information about the llvm-commits mailing list