[PATCH] D51000: [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

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 20 15:02:22 PDT 2018


craig.topper created this revision.
craig.topper added reviewers: RKSimon, spatel, chandlerc, efriedma.

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.


https://reviews.llvm.org/D51000

Files:
  lib/Transforms/Utils/BypassSlowDivision.cpp
  test/CodeGen/X86/divide-by-constant.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51000.161571.patch
Type: text/x-patch
Size: 4953 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180820/a29b4115/attachment.bin>


More information about the llvm-commits mailing list