]> granicus.if.org Git - llvm/commit
[BypassSlowDivision] Handle division by constant numerators better.
authorJustin Lebar <jlebar@google.com>
Wed, 16 Nov 2016 00:44:47 +0000 (00:44 +0000)
committerJustin Lebar <jlebar@google.com>
Wed, 16 Nov 2016 00:44:47 +0000 (00:44 +0000)
commiteb77a4a5377de1e7065cee9a23caa179e6d6b672
tree639cfc078f7aebbd76aa990502fa41264b38c790
parentc18d950852c3961fbf21865eb16de26e0a2ee614
[BypassSlowDivision] Handle division by constant numerators better.

Summary:
We don't do BypassSlowDivision when the denominator is a constant, but
we do do it when the numerator is a constant.

This patch makes two related changes to BypassSlowDivision when the
numerator is a constant:

 * If the numerator is too large to fit into the bypass width, don't
   bypass slow division (because we'll never run the smaller-width
   code).

 * If we bypass slow division where the numerator is a constant, don't
   OR together the numerator and denominator when determining whether
   both operands fit within the bypass width.  We need to check only the
   denominator.

Reviewers: tra

Subscribers: llvm-commits, jholewinski

Differential Revision: https://reviews.llvm.org/D26699

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287062 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/BypassSlowDivision.cpp
test/Transforms/CodeGenPrepare/NVPTX/bypass-slow-div-constant-numerator.ll [new file with mode: 0644]