llvm-6502/lib
Hal Finkel 851b04c920 Make use of @llvm.assume in ValueTracking (computeKnownBits, etc.)
This change, which allows @llvm.assume to be used from within computeKnownBits
(and other associated functions in ValueTracking), adds some (optional)
parameters to computeKnownBits and friends. These functions now (optionally)
take a "context" instruction pointer, an AssumptionTracker pointer, and also a
DomTree pointer, and most of the changes are just to pass this new information
when it is easily available from InstSimplify, InstCombine, etc.

As explained below, the significant conceptual change is that known properties
of a value might depend on the control-flow location of the use (because we
care that the @llvm.assume dominates the use because assumptions have
control-flow dependencies). This means that, when we ask if bits are known in a
value, we might get different answers for different uses.

The significant changes are all in ValueTracking. Two main changes: First, as
with the rest of the code, new parameters need to be passed around. To make
this easier, I grouped them into a structure, and I made internal static
versions of the relevant functions that take this structure as a parameter. The
new code does as you might expect, it looks for @llvm.assume calls that make
use of the value we're trying to learn something about (often indirectly),
attempts to pattern match that expression, and uses the result if successful.
By making use of the AssumptionTracker, the process of finding @llvm.assume
calls is not expensive.

Part of the structure being passed around inside ValueTracking is a set of
already-considered @llvm.assume calls. This is to prevent a query using, for
example, the assume(a == b), to recurse on itself. The context and DT params
are used to find applicable assumptions. An assumption needs to dominate the
context instruction, or come after it deterministically. In this latter case we
only handle the specific case where both the assumption and the context
instruction are in the same block, and we need to exclude assumptions from
being used to simplify their own ephemeral values (those which contribute only
to the assumption) because otherwise the assumption would prove its feeding
comparison trivial and would be removed.

This commit adds the plumbing and the logic for a simple masked-bit propagation
(just enough to write a regression test). Future commits add more patterns
(and, correspondingly, more regression tests).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217342 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-07 18:57:58 +00:00
..
Analysis Make use of @llvm.assume in ValueTracking (computeKnownBits, etc.) 2014-09-07 18:57:58 +00:00
AsmParser Fix typos in comments, NFC 2014-08-29 21:53:01 +00:00
Bitcode Pass a && to getLazyBitcodeModule. 2014-09-03 17:31:46 +00:00
CodeGen DebugInfo: Do not use DW_FORM_GNU_addr_index in skeleton CUs, GDB 7.8 errors on this. 2014-09-07 17:31:42 +00:00
DebugInfo [DWARF parser] Fix nasty memory corruption in .dwo files handling. 2014-09-05 19:29:45 +00:00
ExecutionEngine [MCJIT] Revert partial RuntimeDyldELF cleanup that was prematurely committed in 2014-09-07 04:13:13 +00:00
IR [x86] Fix a pretty horrible bug and inconsistency in the x86 asm 2014-09-06 10:00:01 +00:00
IRReader Pass a && to getLazyBitcodeModule. 2014-09-03 17:31:46 +00:00
LineEditor
Linker Fix pr20078. 2014-09-05 21:27:52 +00:00
LTO unique_ptrify LTOCodeGenerator::NativeObjectFile 2014-09-02 18:21:06 +00:00
MC MC: correct DWARF line info for PE/COFF 2014-09-06 19:57:48 +00:00
Object Restore the ability to check if LLVMCreateObjectFile was successful 2014-09-05 21:22:09 +00:00
Option Fix PR17239 by changing the semantics of the RemainingArgsClass Option kind 2014-08-22 19:29:17 +00:00
ProfileData Make some helpers static or move into the llvm namespace. 2014-09-03 21:04:12 +00:00
Support Check whether the iterator p == the end iterator before trying to dereference it. This is a speculative fix for a failure found on the valgrind buildbot triggered by a clang test. 2014-09-06 01:16:42 +00:00
TableGen Comment only: Annotate loop as per mailing list discussion 2014-08-29 22:43:30 +00:00
Target [x86] Revert my over-eager commit in r217332. 2014-09-07 12:37:11 +00:00
Transforms Make use of @llvm.assume in ValueTracking (computeKnownBits, etc.) 2014-09-07 18:57:58 +00:00
CMakeLists.txt ProfileData: Introduce the InstrProfReader interface and a text reader 2014-03-21 17:24:48 +00:00
LLVMBuild.txt ProfileData: Introduce the InstrProfReader interface and a text reader 2014-03-21 17:24:48 +00:00
Makefile ProfileData: Introduce the InstrProfReader interface and a text reader 2014-03-21 17:24:48 +00:00