[all-commits] [llvm/llvm-project] 3c127e: [ConstraintElim] Replace NUWSub decomp with recurs...

Florian Hahn via All-commits all-commits at lists.llvm.org
Tue Jan 2 14:06:29 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3c127e83c07c3791e86413c22a414a030d4302e3
      https://github.com/llvm/llvm-project/commit/3c127e83c07c3791e86413c22a414a030d4302e3
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2024-01-02 (Tue, 02 Jan 2024)

  Changed paths:
    M llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
    M llvm/test/Transforms/ConstraintElimination/sub-nuw.ll

  Log Message:
  -----------
  [ConstraintElim] Replace NUWSub decomp with recursive decomp of ops.

The current patterns for NUWSub decompositions do not handle negative
constants correctly at the moment (causing #76713).

Replace the incorrect pattern by more general code that recursively
decomposes the operands and then combines the results. This is already
done in most other places that handle operators like add/mul.

This means we fall back to the general constant handling code (fixes the
mis-compile) while also being able to support reasoning about
decomposable expressions in the SUB operands.

Fixes https://github.com/llvm/llvm-project/issues/76713.




More information about the All-commits mailing list