diff options
| author | Hal Finkel <hfinkel@anl.gov> | 2014-07-25 21:13:35 +0000 |
|---|---|---|
| committer | Hal Finkel <hfinkel@anl.gov> | 2014-07-25 21:13:35 +0000 |
| commit | 930469107d34d66b015f6e48b3f05554819216d8 (patch) | |
| tree | 3d23c9a2e9b5241703cbcfcc6040619ea65894d1 /llvm/docs | |
| parent | c888757a2dcaf365a115cd250da045e12af013c1 (diff) | |
| download | bcm5719-llvm-930469107d34d66b015f6e48b3f05554819216d8.tar.gz bcm5719-llvm-930469107d34d66b015f6e48b3f05554819216d8.zip | |
Add @llvm.assume, lowering, and some basic properties
This is the first commit in a series that add an @llvm.assume intrinsic which
can be used to provide the optimizer with a condition it may assume to be true
(when the control flow would hit the intrinsic call). Some basic properties are added here:
- llvm.invariant(true) is dead.
- llvm.invariant(false) is unreachable (this directly corresponds to the
documented behavior of MSVC's __assume(0)), so is llvm.invariant(undef).
The intrinsic is tagged as writing arbitrarily, in order to maintain control
dependencies. BasicAA has been updated, however, to return NoModRef for any
particular location-based query so that we don't unnecessarily block code
motion.
llvm-svn: 213973
Diffstat (limited to 'llvm/docs')
| -rw-r--r-- | llvm/docs/LangRef.rst | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst index 891b9c0af70..25ee61e125a 100644 --- a/llvm/docs/LangRef.rst +++ b/llvm/docs/LangRef.rst @@ -9427,6 +9427,46 @@ Semantics: This intrinsic is lowered to the ``val``. +'``llvm.assume``' Intrinsic +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Syntax: +""""""" + +:: + + declare void @llvm.assume(i1 %cond) + +Overview: +""""""""" + +The ``llvm.assume`` allows the optimizer to assume that the provided +condition is true. This information can then be used in simplifying other parts +of the code. + +Arguments: +"""""""""" + +The condition which the optimizer may assume is always true. + +Semantics: +"""""""""" + +The intrinsic allows the optimizer to assume that the provided condition is +always true whenever the control flow reaches the intrinsic call. No code is +generated for this intrinsic, and instructions that contribute only to the +provided condition are not used for code generation. If the condition is +violated during execution, the behavior is undefined. + +Please note that optimizer might limit the transformations performed on values +used by the ``llvm.assume`` intrinsic in order to preserve the instructions +only used to form the intrinsic's input argument. This might prove undesirable +if the extra information provided by the ``llvm.assume`` intrinsic does cause +sufficient overall improvement in code quality. For this reason, +``llvm.assume`` should not be used to document basic mathematical invariants +that the optimizer can otherwise deduce or facts that are of little use to the +optimizer. + '``llvm.donothing``' Intrinsic ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |

