llvm/lib
Craig Topper 58c7fe69d0 [ValueTracking] Introduce a KnownBits struct to wrap the two APInts for computeKnownBits
This patch introduces a new KnownBits struct that wraps the two APInt used by computeKnownBits. This allows us to treat them as more of a unit.

Initially I've just altered the signatures of computeKnownBits and InstCombine's simplifyDemandedBits to pass a KnownBits reference instead of two separate APInt references. I'll do similar to the SelectionDAG version of computeKnownBits/simplifyDemandedBits as a separate patch.

I've added a constructor that allows initializing both APInts to the same bit width with a starting value of 0. This reduces the repeated pattern of initializing both APInts. Once place default constructed the APInts so I added a default constructor for those cases.

Going forward I would like to add more methods that will work on the pairs. For example trunc, zext, and sext occur on both APInts together in several places. We should probably add a clear method that can be used to clear both pieces. Maybe a method to check for conflicting information. A method to return (Zero|One) so we don't write it out everywhere. Maybe a method for (Zero|One).isAllOnesValue() to determine if all bits are known. I'm sure there are many other methods we can come up with.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301432 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 16:39:58 +00:00
..
Analysis [ValueTracking] Introduce a KnownBits struct to wrap the two APInts for computeKnownBits 2017-04-26 16:39:58 +00:00
AsmParser
Bitcode Reverts commit r301424, r301425 and r301426 2017-04-26 16:37:05 +00:00
CodeGen [ValueTracking] Introduce a KnownBits struct to wrap the two APInts for computeKnownBits 2017-04-26 16:39:58 +00:00
DebugInfo [llvm-pdbdump] Allow sorting / filtering by immediate padding 2017-04-25 20:22:29 +00:00
Demangle
ExecutionEngine Revert "[APInt] Fix a few places that use APInt::getRawData to operate within the normal API." 2017-04-23 12:15:30 +00:00
Fuzzer Fixup for r301054: Use an explicit constructor. 2017-04-21 23:28:01 +00:00
IR Reverts commit r301424, r301425 and r301426 2017-04-26 16:37:05 +00:00
IRReader
LibDriver
LineEditor
Linker
LTO
MC PR31007 and PR27884 will be closed: a possibility to compile constants like 0bH is now supported in MS asm. 2017-04-26 09:56:59 +00:00
Object revert debugging 2017-04-26 00:02:39 +00:00
ObjectYAML [WebAssembly] Allow for signed relocation addends 2017-04-26 00:02:31 +00:00
Option
Passes Simplify the CFG after loop pass cleanup. 2017-04-26 12:02:41 +00:00
ProfileData
Support Revert "Refactor DynamicLibrary so searching for a symbol will have a defined order" 2017-04-24 20:16:01 +00:00
TableGen
Target [ValueTracking] Introduce a KnownBits struct to wrap the two APInts for computeKnownBits 2017-04-26 16:39:58 +00:00
Transforms [ValueTracking] Introduce a KnownBits struct to wrap the two APInts for computeKnownBits 2017-04-26 16:39:58 +00:00
XRay
CMakeLists.txt
LLVMBuild.txt