OSDN Git Service

[DAGCombiner] fold sext into decrement
authorSanjay Patel <spatel@rotateright.com>
Fri, 29 Mar 2019 13:49:08 +0000 (13:49 +0000)
committerSanjay Patel <spatel@rotateright.com>
Fri, 29 Mar 2019 13:49:08 +0000 (13:49 +0000)
commit2c4f9d155df688c423431efcfb0eade1e06385df
tree1254c7b973d5887e1dfc8e769b0d043cb8df60b7
parent03b3201cc29cf4565910d1eba34629790f8c5a53
[DAGCombiner] fold sext into decrement

This is a sibling to rL357178 that I noticed we'd hit if we chose
an alternate transform in D59818.

  %z = zext i8 %x to i32
  %dec = add i32 %z, -1
  %r = sext i32 %dec to i64
  =>
  %z2 = zext i8 %x to i64
  %r = add i64 %z2, -1

https://rise4fun.com/Alive/kPP

The x86 vector diffs show a slight regression, so there's a chance
that we should limit this and the previous transform to scalars.

But given that we allowed vectors before, I'm matching that behavior
here. We should change both transforms together if that's the right
thing to do.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357254 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/X86/sext-i1.ll
test/CodeGen/X86/vector-sext.ll