forked from OSchip/llvm-project
[LICM] Add tests highlighting missing hoists for intrinsics [NFC]
llvm-svn: 339054
This commit is contained in:
parent
9452359887
commit
81c7dc93d2
|
@ -35,8 +35,10 @@ for.end104:
|
|||
|
||||
define void @f_1(i1 %cond, i32* %ptr) {
|
||||
; CHECK-LABEL: @f_1(
|
||||
; CHECK-LABEL: entry:
|
||||
; CHECK: %val = load i32, i32* %ptr
|
||||
; CHECK-NEXT: br label %loop
|
||||
; CHECK-LABEL: loop:
|
||||
; CHECK: call void @llvm.assume(i1 %cond)
|
||||
|
||||
entry:
|
||||
br label %loop
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
; RUN: opt -licm -basicaa < %s -S | FileCheck %s
|
||||
; RUN: opt -aa-pipeline=basic-aa -passes='require<aa>,require<targetir>,require<scalar-evolution>,require<opt-remark-emit>,loop(licm)' < %s -S | FileCheck %s
|
||||
|
||||
; TODO: should be able to hoist both guard and load
|
||||
define void @test1(i1 %cond, i32* %ptr) {
|
||||
; CHECK-LABEL: @test1(
|
||||
; CHECK-LABEL: entry:
|
||||
; CHECK-LABEL: loop:
|
||||
; CHECK: call void (i1, ...) @llvm.experimental.guard(i1 %cond)
|
||||
; CHECK: %val = load i32, i32* %ptr
|
||||
|
||||
entry:
|
||||
br label %loop
|
||||
|
||||
loop:
|
||||
%x = phi i32 [ 0, %entry ], [ %x.inc, %loop ]
|
||||
call void (i1, ...) @llvm.experimental.guard(i1 %cond) ["deopt" (i32 0)]
|
||||
%val = load i32, i32* %ptr
|
||||
%x.inc = add i32 %x, %val
|
||||
br label %loop
|
||||
}
|
||||
|
||||
declare void @llvm.experimental.guard(i1, ...)
|
|
@ -0,0 +1,23 @@
|
|||
; RUN: opt -licm -basicaa < %s -S | FileCheck %s
|
||||
; RUN: opt -aa-pipeline=basic-aa -passes='require<aa>,require<targetir>,require<scalar-evolution>,require<opt-remark-emit>,loop(licm)' < %s -S | FileCheck %s
|
||||
|
||||
; TODO: should be able to hoist both load and invariant.start
|
||||
define void @test1(i1 %cond, i32* %ptr) {
|
||||
; CHECK-LABEL: @test1(
|
||||
; CHECK-LABEL: entry:
|
||||
; CHECK-LABEL: loop:
|
||||
; CHECK: call {}* @llvm.invariant.start.p0i32(i64 4, i32* %ptr)
|
||||
; CHECK: %val = load i32, i32* %ptr
|
||||
|
||||
entry:
|
||||
br label %loop
|
||||
|
||||
loop:
|
||||
%x = phi i32 [ 0, %entry ], [ %x.inc, %loop ]
|
||||
call {}* @llvm.invariant.start.p0i32(i64 4, i32* %ptr)
|
||||
%val = load i32, i32* %ptr
|
||||
%x.inc = add i32 %x, %val
|
||||
br label %loop
|
||||
}
|
||||
|
||||
declare {}* @llvm.invariant.start.p0i32(i64, i32*)
|
Loading…
Reference in New Issue