[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)
commitfca527af5c5454efdde8cdf2c54d21074ac76c90
treef1f65b1617f4aba73c93c177d711bf0820c282fe
parentdddce31eb4961578564e0cd2671286b967e06b78
[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

llvm-svn: 299329
llvm/lib/Transforms/Utils/BypassSlowDivision.cpp
llvm/test/Transforms/CodeGenPrepare/NVPTX/bypass-slow-div-special-cases.ll