summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
diff options
context:
space:
mode:
authorTim Corringham <tcorring@amd.com>2019-08-08 13:46:17 +0000
committerTim Corringham <tcorring@amd.com>2019-08-08 13:46:17 +0000
commit4f64f1ba3c540cddbcf3f7f5e5b8a2fd9ebbb416 (patch)
tree69bb4c8a06f78dafb8905900509c5f5ba51eebe5 /llvm/lib/Transforms/Scalar
parent195ae90307bdbfcb7393da5dfbbb2bb38ff24107 (diff)
downloadbcm5719-llvm-4f64f1ba3c540cddbcf3f7f5e5b8a2fd9ebbb416.tar.gz
bcm5719-llvm-4f64f1ba3c540cddbcf3f7f5e5b8a2fd9ebbb416.zip
Add llvm.licm.disable metadata
For some targets the LICM pass can result in sub-optimal code in some cases where it would be better not to run the pass, but it isn't always possible to suppress the transformations heuristically. Where the front-end has insight into such cases it is beneficial to attach loop metadata to disable the pass - this change adds the llvm.licm.disable metadata to enable that. Differential Revision: https://reviews.llvm.org/D64557 llvm-svn: 368296
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-rw-r--r--llvm/lib/Transforms/Scalar/LICM.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index d9dda4cef2d..e018eb688e0 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -330,6 +330,12 @@ bool LoopInvariantCodeMotion::runOnLoop(
assert(L->isLCSSAForm(*DT) && "Loop is not in LCSSA form.");
+ // If this loop has metadata indicating that LICM is not to be performed then
+ // just exit.
+ if (hasDisableLICMTransformsHint(L)) {
+ return false;
+ }
+
std::unique_ptr<AliasSetTracker> CurAST;
std::unique_ptr<MemorySSAUpdater> MSSAU;
bool NoOfMemAccTooLarge = false;
OpenPOWER on IntegriCloud