Skip to content

Fix some Variable alignment propagation in the simplifier. - #9333

Merged
mcourteaux merged 3 commits into
mainfrom
mcourteaux/fix-some-alignment-propagation
Aug 14, 2026
Merged

Fix some Variable alignment propagation in the simplifier.#9333
mcourteaux merged 3 commits into
mainfrom
mcourteaux/fix-some-alignment-propagation

Conversation

@mcourteaux

@mcourteaux mcourteaux commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

learn_true(x == y) with x and y vars did not fuse their alignment and bounds info.

Fixes #9328.
Partial resolution for #9327 by adding const which avoids accidental assignment.

Breaking changes

None I'm aware of.

Checklist

  • Tests added or updated (not required for docs, CI config, or typo fixes)
  • Documentation updated (if public API changed)
  • Python bindings updated (if public API changed)
  • Benchmarks are included here if the change is intended to affect performance.
  • Commits include AI attribution where applicable (see Code of Conduct)

mcourteaux and others added 2 commits August 13, 2026 19:01
…learn_true(varA == varB) is processed.

Co-authored-by: Alex Reinking <areinking@adobe.com>
@mcourteaux mcourteaux changed the title Mcourteaux/fix some alignment propagation Fix some Variable alignment propagation in the simplifier. Aug 13, 2026
@mcourteaux
mcourteaux requested a review from abadams August 13, 2026 17:03
@alexreinking

Copy link
Copy Markdown
Member

Can you add a regression test somewhere?

@alexreinking

Copy link
Copy Markdown
Member

clang-tidy rejects the const-return-value trick. Please drop that commit for this PR; I'm still on the fence about whether I'd like to use a proxy object anyway.

…lp avoid accidental assignment."

This reverts commit 90b97b1.
@abadams

abadams commented Aug 13, 2026

Copy link
Copy Markdown
Member

Apparently it's preferred to forbid operator= on rvalues on the type in question, rather than return const things (which breaks moving from them). E.g in struct Expr:

Expr &operator=(const Expr &) & = default;

Note the final &, which prevents assigning to rvalue Exprs.

@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.04%. Comparing base (4b349d8) to head (20ff39e).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9333      +/-   ##
==========================================
+ Coverage   69.92%   70.04%   +0.12%     
==========================================
  Files         258      258              
  Lines       78239    78252      +13     
  Branches    19047    19050       +3     
==========================================
+ Hits        54705    54810     +105     
+ Misses      17801    17786      -15     
+ Partials     5733     5656      -77     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mcourteaux
mcourteaux merged commit a502911 into main Aug 14, 2026
29 of 30 checks passed
@mcourteaux

mcourteaux commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

Can you add a regression test somewhere?

Oops. Working on the regression test. Building on top of your correctness_vector_store_alignment.

UPDATE: regression test added in #9337.

@mcourteaux

Copy link
Copy Markdown
Contributor Author

I'd argue the clang-tidy warning is just dumb?

/home/runner/work/Halide/Halide/src/Dimension.cpp:47:1: error: return type 'const Expr' is 'const'-qualified at the top level, which may reduce code readability without improving const correctness [readability-const-return-type,-warnings-as-errors]

   47 | const Expr Dimension::stride() const {
      | ^~~~~

Error: return type 'const Expr' is 'const'-qualified at the top level%2C which may reduce code readability without improving const correctness

It does improve const correctness.

Expr &operator=(const Expr &) & = default;

I guess you meant = delete, @abadams ?

mcourteaux added a commit that referenced this pull request Aug 14, 2026
…fixed here.

Move image checks below the user-defined requirements.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add_requirement() fails to transitively infer alignment

3 participants