Landing: 41596ef9be64

Project / Subsystem

gcc / tree-ssa-loop-im

Date

2026-09-03

Author

Kyrylo Tkachov

Commit

41596ef9be648c8488165c95be1aacb228ad6750

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
tree-ssa-loop-im
patch_id
—
commit_hash
41596ef9be648c8488165c95be1aacb228ad6750
source_type
github
headline
tree-ssa-loop-im: Reject trapping store motion with non-call EH
tldr
Disallows moving stores out of loops when non-call exceptions are enabled to prevent incorrect behavior.
author
Kyrylo Tkachov
outcome
committed
performance_win
false
breaking_change
false
series_id
—
series_parts
[]
tags
  • • optimization
  • • exception handling
discussion_id_link
—
bugzilla_pr
—
date
2026-09-03T00:00:00.000Z

The loop invariant motion (LIM) pass in GCC incorrectly handled exception information when moving stores out of loops. Previously, it treated bare memory references as loads, and a safe load didn’t prove a store to the same address couldn’t trap. This change ensures that trapping stores are rejected when exception handling is enabled and non-call exceptions can be thrown, preventing potential runtime errors. A new test case verifies this behavior.