1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 05:01:59 +01:00
llvm-mirror/test/Transforms/LICM/pragma-licm-disable.ll
Tim Corringham b6d4024f9b 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
2019-08-08 13:46:17 +00:00

34 lines
1.0 KiB
LLVM

; 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"}