diff options
author | Tim Corringham <tcorring@amd.com> | 2019-08-08 13:46:17 +0000 |
---|---|---|
committer | Tim Corringham <tcorring@amd.com> | 2019-08-08 13:46:17 +0000 |
commit | 4f64f1ba3c540cddbcf3f7f5e5b8a2fd9ebbb416 (patch) | |
tree | 69bb4c8a06f78dafb8905900509c5f5ba51eebe5 /llvm/test/Transforms | |
parent | 195ae90307bdbfcb7393da5dfbbb2bb38ff24107 (diff) | |
download | bcm5719-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/test/Transforms')
-rw-r--r-- | llvm/test/Transforms/LICM/pragma-licm-disable.ll | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/llvm/test/Transforms/LICM/pragma-licm-disable.ll b/llvm/test/Transforms/LICM/pragma-licm-disable.ll new file mode 100644 index 00000000000..cba109943e3 --- /dev/null +++ b/llvm/test/Transforms/LICM/pragma-licm-disable.ll @@ -0,0 +1,33 @@ +; RUN: opt < %s -S -basicaa -licm | FileCheck %s + +; Check that the LICM pass does not operate on a loop which has the +; llvm.licm.disable metadata. +; CHECK-LABEL: @licm_disable +; CHECK: entry: +; CHECK-NOT: load +; CHECK: do.body: +; CHECK: load i64, i64* bitcast (i32** @in to i64*) + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-pc-windows-msvc" + +@in = internal unnamed_addr global i32* null, align 8 +@out = internal unnamed_addr global i32* null, align 8 + +define void @licm_disable(i32 %N) { +entry: + br label %do.body + +do.body: ; preds = %entry + %i.0 = phi i32 [ 0, %entry ], [ %inc, %do.body ] + %v1 = load i64, i64* bitcast (i32** @in to i64*), align 8 + store i64 %v1, i64* bitcast (i32** @out to i64*), align 8 + %inc = add nsw i32 %i.0, 1 + %cmp = icmp slt i32 %inc, %N + br i1 %cmp, label %do.body, label %do.end, !llvm.loop !1 + +do.end: ; preds = %do.body + ret void +} +!1 = !{!1, !2} +!2 = !{!"llvm.licm.disable"} |