[llvm] AlignmentFromAssumptions should only track pointer operand users (PR #73370)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 30 01:50:22 PST 2023


================
@@ -266,22 +262,27 @@ bool AlignmentFromAssumptionsPass::processAssumption(CallInst *ACall,
 
     // Now that we've updated that use of the pointer, look for other uses of
     // the pointer to update.
-    Visited.insert(J);
-    for (User *UJ : J->users()) {
-      Instruction *K = cast<Instruction>(UJ);
-      if (!Visited.count(K))
-        WorkList.push_back(K);
-    }
+    if (auto UJ = dyn_cast<User>(J))
+      for (auto &U : UJ->uses()) {
+        if (U->getType()->isPointerTy()) {
+          if (AA->alias(U, AAPtr)) {
----------------
nikic wrote:

Using AA in this way is not appropriate. You should just do a check like `isa<GetElementPtrInst>(U) || isa<PHINode>(U))` check here.

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


More information about the llvm-commits mailing list