Landing: 61e2300bc936

Project / Subsystem

gcc / gcc/range-op

Date

2026-05-30

Author

Andrew Pinski

Commit

61e2300bc9364a9060aca12ba189d5bbca950aff

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
gcc/range-op
patch_id
commit_hash
61e2300bc9364a9060aca12ba189d5bbca950aff
source_type
github
headline
Range-op: Teach multiplication about non-negative results.
tldr
The range analysis pass now understands that a*a is non-negative, which helps optimize RISC-V VSETVL.
author
Andrew Pinski
outcome
committed
performance_win
true
breaking_change
false
series_id
series_parts
[]
tags
  • optimization
  • range analysis
  • risc-v
  • aarch64
discussion_id_link
bugzilla_pr
date
2026-05-30T00:00:00.000Z

The value range propagation (VRP) pass now recognizes that the square of a variable is non-negative. This helps the compiler deduce tighter bounds for expressions involving multiplication. AArch64 and RISC-V VSETVL instructions benefit from this optimization. Two new testcases, vrp-mult-nonneg-1.c and vrp-mult-nonneg-2.c, validate the fix.