Skip to content

[Analysis] Remove an unreachable check. NFC. #152874

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 10, 2025

Conversation

dtcxzyw
Copy link
Member

@dtcxzyw dtcxzyw commented Aug 9, 2025

Binops never produce pointer values.

@dtcxzyw dtcxzyw requested a review from nikic August 9, 2025 17:58
@llvmbot llvmbot added the llvm:analysis Includes value tracking, cost tables and constant folding label Aug 9, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 9, 2025

@llvm/pr-subscribers-llvm-analysis

Author: Yingwei Zheng (dtcxzyw)

Changes

Binops never produce pointer values.


Full diff: https://github.com/llvm/llvm-project/pull/152874.diff

1 Files Affected:

  • (modified) llvm/lib/Analysis/Loads.cpp (+1-2)
diff --git a/llvm/lib/Analysis/Loads.cpp b/llvm/lib/Analysis/Loads.cpp
index 78d0887d5d87e..9a2c9ba63ec7e 100644
--- a/llvm/lib/Analysis/Loads.cpp
+++ b/llvm/lib/Analysis/Loads.cpp
@@ -276,8 +276,7 @@ static bool AreEquivalentAddressValues(const Value *A, const Value *B) {
   // this function is only used when one address use dominates the
   // other, which means that they'll always either have the same
   // value or one of them will have an undefined value.
-  if (isa<BinaryOperator>(A) || isa<CastInst>(A) || isa<PHINode>(A) ||
-      isa<GetElementPtrInst>(A))
+  if (isa<CastInst>(A) || isa<PHINode>(A) || isa<GetElementPtrInst>(A))
     if (const Instruction *BI = dyn_cast<Instruction>(B))
       if (cast<Instruction>(A)->isIdenticalToWhenDefined(BI))
         return true;

@dtcxzyw dtcxzyw merged commit 2242e28 into llvm:main Aug 10, 2025
11 checks passed
@dtcxzyw dtcxzyw deleted the are-equiv-addr-values branch August 10, 2025 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
llvm:analysis Includes value tracking, cost tables and constant folding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants