[PATCH] D27714: [DAGCombiner] Use SelectionDAG::isKnownToBeAPowerOfTwo instead of just APInt::isPowerOf2
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 13 07:31:54 PST 2016
RKSimon created this revision.
RKSimon added reviewers: majnemer, eli.friedman, spatel, andreadb.
RKSimon added a subscriber: llvm-commits.
RKSimon set the repository for this revision to rL LLVM.
Generalize sdiv/udiv/srem/urem combines using APInt::isPowerOf2, which only works for const/splat-const values to call SelectionDAG::isKnownToBeAPowerOfTwo instead which recognises many more cases.
Added a DAGCombiner::BuildLogBase2 helper since PowerOf2 combines often involve taking the log2 of such a value.
Repository:
rL LLVM
https://reviews.llvm.org/D27714
Files:
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
test/CodeGen/X86/combine-sdiv.ll
test/CodeGen/X86/combine-srem.ll
test/CodeGen/X86/combine-udiv.ll
test/CodeGen/X86/combine-urem.ll
test/CodeGen/X86/urem-power-of-two.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27714.81232.patch
Type: text/x-patch
Size: 19977 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161213/a6cd044b/attachment.bin>
More information about the llvm-commits
mailing list