OSDN Git Service

[BypassSlowDivision] Do not bypass division of hash-like values
authorNikolai Bozhenov <nikolai.bozhenov@intel.com>
Sun, 2 Apr 2017 13:14:30 +0000 (13:14 +0000)
committerNikolai Bozhenov <nikolai.bozhenov@intel.com>
Sun, 2 Apr 2017 13:14:30 +0000 (13:14 +0000)
commit650bf3e599576d64f8dc421848933e176b8e1730
tree6d46683e13e79753565bda0591338c458336d198
parentbd2ffa7d854590c674ea5aed4ac7a60f8ca52a5d
[BypassSlowDivision] Do not bypass division of hash-like values

Disable bypassing if one of the operands looks like a hash value. Slow
division often occurs in hashtable implementations and fast division is
never taken there because a hash value is extremely unlikely to have
enough upper bits set to zero.

A value is considered to be hash-like if it is produced by

1) XOR operation
2) Multiplication by a constant wider than the shorter type
3) PHI node with all incoming values being hash-like

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299329 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/BypassSlowDivision.cpp
test/Transforms/CodeGenPrepare/NVPTX/bypass-slow-div-special-cases.ll