OSDN Git Service

[BypassSlowDivision] Teach bypass slow division not to interfere with div by constant...
authorCraig Topper <craig.topper@intel.com>
Tue, 21 Aug 2018 17:15:33 +0000 (17:15 +0000)
committerCraig Topper <craig.topper@intel.com>
Tue, 21 Aug 2018 17:15:33 +0000 (17:15 +0000)
commit01ee4bc18313b7b0979a7a5b05492f2fff5b5d35
tree8bebcd203a14095509f3bd9573790939c210ab49
parentaf456551b43688ac26ab6fa4dcafff1d45d3a860
[BypassSlowDivision] Teach bypass slow division not to interfere with div by constant where constants have been constant hoisted, but not moved from their basic block

DAGCombiner doesn't pay attention to whether constants are opaque before doing the div by constant optimization. So BypassSlowDivision shouldn't introduce control flow that would make DAGCombiner unable to see an opaque constant. This can occur when a div and rem of the same constant are used in the same basic block. it will be hoisted, but not leave the block.

Longer term we probably need to look into the X86 immediate cost model used by constant hoisting and maybe not mark div/rem immediates for hoisting at all.

This fixes the case from PR38649.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340303 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/BypassSlowDivision.cpp
test/CodeGen/X86/divide-by-constant.ll