[PATCH] D60396: [InstCombine] sdiv exact flag fixup

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 7 23:39:58 PDT 2019


lebedev.ri added a comment.

Looks good, but a question re tests.

  ----------------------------------------
  Optimization: zz
  Precondition: ((C != 1) && (C != -128))
    %div = sdiv exact i8 %x, C
    %r = sub i8 0, %div
  =>
    %r = sdiv exact i8 %x, -C
  
  Done: 1
  Optimization is correct!



================
Comment at: llvm/test/Transforms/InstCombine/div.ll:763
 
 define i32 @test_exact(i32 %x) {
 ; CHECK-LABEL: @test_exact(
----------------
Please add more tests.
* Variant with nsw, but without exact
* Variant without nsw, but with exact
* Variant without nsw, and without exact
* ???
* Are there tests with C = 1, C = MinSigned ?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60396/new/

https://reviews.llvm.org/D60396





More information about the llvm-commits mailing list