[llvm] [LLVM][InstCombiner] foldICmpEquality: Compare APInt values rather than addresses. (PR #151726)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 1 09:39:29 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Paul Walker (paulwalker-arm)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/151726.diff
2 Files Affected:
- (modified) llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp (+1-1)
- (modified) llvm/test/Transforms/InstCombine/compare-signs.ll (+1)
``````````diff
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index da9b12686a8f1..c88891563e72d 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -6083,7 +6083,7 @@ Instruction *InstCombinerImpl::foldICmpEquality(ICmpInst &I) {
match(Op1, m_OneUse(m_LShr(m_Value(B), m_APIntAllowPoison(AP2))))) ||
(match(Op0, m_OneUse(m_AShr(m_Value(A), m_APIntAllowPoison(AP1)))) &&
match(Op1, m_OneUse(m_AShr(m_Value(B), m_APIntAllowPoison(AP2)))))) {
- if (AP1 != AP2)
+ if (*AP1 != *AP2)
return nullptr;
unsigned TypeBits = AP1->getBitWidth();
unsigned ShAmt = AP1->getLimitedValue(TypeBits);
diff --git a/llvm/test/Transforms/InstCombine/compare-signs.ll b/llvm/test/Transforms/InstCombine/compare-signs.ll
index 59ec9adb30b9e..bed0f6966dd89 100644
--- a/llvm/test/Transforms/InstCombine/compare-signs.ll
+++ b/llvm/test/Transforms/InstCombine/compare-signs.ll
@@ -1,5 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes=instcombine -S < %s | FileCheck %s
+; RUN: opt -passes=instcombine -use-constant-int-for-fixed-length-splat -S < %s | FileCheck %s
; PR5438
``````````
</details>
https://github.com/llvm/llvm-project/pull/151726
More information about the llvm-commits
mailing list