[all-commits] [llvm/llvm-project] 0ae6bc: [InstCombine] add tests for full-right-shift of sd...

Sanjay Patel via All-commits all-commits at lists.llvm.org
Sun Sep 18 10:13:33 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0ae6bc077149041772b8595e6aeae29519bfb96e
      https://github.com/llvm/llvm-project/commit/0ae6bc077149041772b8595e6aeae29519bfb96e
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2022-09-18 (Sun, 18 Sep 2022)

  Changed paths:
    M llvm/test/Transforms/InstCombine/shift.ll

  Log Message:
  -----------
  [InstCombine] add tests for full-right-shift of sdiv; NFC


  Commit: 1d1d1e6f226dd9d56f824b4cf502a0037ff86f32
      https://github.com/llvm/llvm-project/commit/1d1d1e6f226dd9d56f824b4cf502a0037ff86f32
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2022-09-18 (Sun, 18 Sep 2022)

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

  Log Message:
  -----------
  [InstCombine] fold full-shift of sdiv to icmp+extend

This is a disguised sign-bit test with offset:
(X / +DivC) >> (Width - 1) --> ext (X <= -DivC)
(X / -DivC) >> (Width - 1) --> ext (X >= +DivC)

https://alive2.llvm.org/ce/z/cO8JO4

We don't match/test poison in the sdiv constant because
that would be immediate undefined behavior.


Compare: https://github.com/llvm/llvm-project/compare/1a14436c35b4...1d1d1e6f226d


More information about the All-commits mailing list