From fb3da5cce1b3cc76db2fa61e87e4b4cc9da4ff1c Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Sun, 26 Apr 2015 22:23:12 +0000 Subject: [PATCH] [PerformanceTips] Provide context on the impact of assume(x) Sean Silva suggested I add something here a while back. Sorry it's taken so long to get back to this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235826 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/Frontend/PerformanceTips.rst | 9 ++++++++- docs/LangRef.rst | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/Frontend/PerformanceTips.rst b/docs/Frontend/PerformanceTips.rst index 53ab11b430c..efc4d1c280f 100644 --- a/docs/Frontend/PerformanceTips.rst +++ b/docs/Frontend/PerformanceTips.rst @@ -144,7 +144,7 @@ Other things to consider #. When checking a value against a constant, emit the check using a consistent comparison type. The GVN pass _will_ optimize redundant equalities even if the type of comparison is inverted, but GVN only runs late in the pipeline. - As a result, you may miss the oppurtunity to run other important + As a result, you may miss the opportunity to run other important optimizations. Improvements to EarlyCSE to remove this issue are tracked in Bug 23333. @@ -157,6 +157,13 @@ Other things to consider profitable to emit these directly in the language frontend. This item explicitly includes the use of the :ref:`overflow intrinsics `. +#. Avoid using the :ref:`assume intrinsic ` until you've + established that a) there's no other way to express the given fact and b) + that fact is critical for optimization purposes. Assumes are a great + prototyping mechanism, but they can have negative effects on both compile + time and optimization effectiveness. The former is fixable with enough + effort, but the later is fairly fundamental to their designed purpose. + p.s. If you want to help improve this document, patches expanding any of the above items into standalone sections of their own with a more complete discussion would be very welcome. diff --git a/docs/LangRef.rst b/docs/LangRef.rst index f51870f66a5..767d97a6c81 100644 --- a/docs/LangRef.rst +++ b/docs/LangRef.rst @@ -10285,6 +10285,8 @@ Semantics: This intrinsic is lowered to the ``val``. +.. _int_assume: + '``llvm.assume``' Intrinsic ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^