[llvm] [SimplifyCFG] Select the first instruction that we can handle in `passingValueIsAlwaysUndefined` (PR #98802)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 14 02:53:06 PDT 2024


================
@@ -7573,13 +7573,25 @@ static bool passingValueIsAlwaysUndefined(Value *V, Instruction *I, bool PtrValu
     return false;
 
   if (C->isNullValue() || isa<UndefValue>(C)) {
-    // Only look at the first use, avoid hurting compile time with long uselists
-    auto *Use = cast<Instruction>(*I->user_begin());
-    // Bail out if Use is not in the same BB as I or Use == I or Use comes
-    // before I in the block. The latter two can be the case if Use is a PHI
-    // node.
-    if (Use->getParent() != I->getParent() || Use == I || Use->comesBefore(I))
+    // Only look at the first use we can hanle, avoid hurting compile time with
----------------
dtcxzyw wrote:

```suggestion
    // Only look at the first use we can handle, avoid hurting compile time with
```

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


More information about the llvm-commits mailing list