[all-commits] [llvm/llvm-project] 664ae7: [InstCombine] C0 <<{nsw, nuw} (X - C1) --> (C0 >> ...

Sanjay Patel via All-commits all-commits at lists.llvm.org
Thu Apr 21 13:27:30 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 664ae7bbcc74972531a73d33d7933fc5aa0c0db4
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2022-04-21 (Thu, 21 Apr 2022)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
    M llvm/test/Transforms/InstCombine/shift-add.ll

  Log Message:
  [InstCombine] C0 <<{nsw, nuw} (X - C1) --> (C0 >> C1) << X (2nd try)

The first attempt at this missed a check to make sure the offset
constant was in range and caused many bot failures.

That was missed in the Alive2 proof because on overshift creates
poison rather than the assert from APInt. Here's an alternate
attempt at a proof using count-trailing-zeros:

Original commit message:

This is similar to an existing pre-shift-of-constant fold:
...but in this case, we need no-wrap on the shl and a negative

More information about the All-commits mailing list