[PATCH] D32339: [APInt] Add compare/compareSigned methods that return -1, 0, 1. Reimplement slt/ult and friends using them
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 20 23:40:25 PDT 2017
craig.topper created this revision.
Currently sle and ule have to call slt/ult and eq to get the proper answer. This results in extra code for both calls and additional scans of multiword APInts.
This patch replaces slt/ult with a compareSigned/compare that can return -1, 0, or 1 so we can cover all the comparison functions with a single call.
While I was there I removed the activeBits calls and other checks at the start of the slow part of ult. Both of the activeBits calls potentially scan through each of the APInts separately. I can't imagine that's any better than just scanning them in parallel and doing the compares.
These changes seem to be good for about a 7-8k reduction on the size of the opt binary on my local x86-64 build.
https://reviews.llvm.org/D32339
Files:
include/llvm/ADT/APInt.h
lib/Support/APInt.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32339.96100.patch
Type: text/x-patch
Size: 4905 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170421/7db69a14/attachment.bin>
More information about the llvm-commits
mailing list