[llvm-branch-commits] [llvm] [SCEVDivision] Remove unnecessary integer promotion (NFCI) (PR #208155)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jul 14 02:18:49 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-analysis

Author: Ryotaro Kasuga (kasuga-fj)

<details>
<summary>Changes</summary>

Since #<!-- -->204146 requires callers of SCEVDivision to pass the numerator and the denominator with the same type, the bitwidth check in `visitConstant` no longer makes sense.

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


1 Files Affected:

- (modified) llvm/lib/Analysis/ScalarEvolutionDivision.cpp (+2-7) 


``````````diff
diff --git a/llvm/lib/Analysis/ScalarEvolutionDivision.cpp b/llvm/lib/Analysis/ScalarEvolutionDivision.cpp
index 8bd5cb9d339b2..1fda62361667c 100644
--- a/llvm/lib/Analysis/ScalarEvolutionDivision.cpp
+++ b/llvm/lib/Analysis/ScalarEvolutionDivision.cpp
@@ -111,13 +111,8 @@ void SCEVDivision::visitConstant(const SCEVConstant *Numerator) {
   if (const SCEVConstant *D = dyn_cast<SCEVConstant>(Denominator)) {
     APInt NumeratorVal = Numerator->getAPInt();
     APInt DenominatorVal = D->getAPInt();
-    uint32_t NumeratorBW = NumeratorVal.getBitWidth();
-    uint32_t DenominatorBW = DenominatorVal.getBitWidth();
-
-    if (NumeratorBW > DenominatorBW)
-      DenominatorVal = DenominatorVal.sext(NumeratorBW);
-    else if (NumeratorBW < DenominatorBW)
-      NumeratorVal = NumeratorVal.sext(DenominatorBW);
+    assert(NumeratorVal.getBitWidth() == DenominatorVal.getBitWidth() &&
+           "Numerator and Denominator must have the same bit width");
 
     APInt QuotientVal(NumeratorVal.getBitWidth(), 0);
     APInt RemainderVal(NumeratorVal.getBitWidth(), 0);

``````````

</details>


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


More information about the llvm-branch-commits mailing list