[PATCH] D60426: [InstCombine] prevent possible miscompile with negate+sdiv of vector op

ChenZheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 8 22:38:33 PDT 2019


shchenz accepted this revision.
shchenz added a comment.
This revision is now accepted and ready to land.

LGTM for this patch.

But should we also consider about the following pattern in file `test/Transforms/InstCombine/div.ll`

  define <2 x i64> @test34(<2 x i64> %x) {
  ; CHECK-LABEL: @test34(
  ; CHECK-NEXT:    [[DIV:%.*]] = sdiv exact <2 x i64> [[X:%.*]], <i64 -3, i64 -4>
  ; CHECK-NEXT:    ret <2 x i64> [[DIV]]
  ;
    %neg = sub nsw <2 x i64> zeroinitializer, %x
    %div = sdiv exact <2 x i64> %neg, <i64 3, i64 4>
    ret <2 x i64> %div
  }

This one is `sdiv (neg(%x), constant)`, it should have same issue, right? But I think this should be another issue about `sdiv` combination?


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

https://reviews.llvm.org/D60426





More information about the llvm-commits mailing list