[llvm] [LLVM][SCEV] Look through common multiplicand when simplifying compares. (PR #141798)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 1 07:19:15 PDT 2025


================
@@ -0,0 +1,378 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; RUN: opt -S -passes=indvars < %s | FileCheck %s
+
+; Verify ScalarEvolution can simplify comparisons of the form:
+;    (X * Z) icmp (Y * Z) ==> X icmp Y
+; which allows IndVarSimplify to "remove" control flow.
+
+define void @signed_icmp_mul_common_multiplicand(ptr %loc) vscale_range(1,1073741824) {
----------------
nikic wrote:

I think that's what the current LangRef wording is already meant to imply -- it would be unusual to use the word "positive" if what we actually mean is "non-zero"...

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


More information about the llvm-commits mailing list