[llvm] r339054 - [LICM] Add tests highlighting missing hoists for intrinsics [NFC]
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 6 14:06:15 PDT 2018
Author: reames
Date: Mon Aug 6 14:06:15 2018
New Revision: 339054
URL: http://llvm.org/viewvc/llvm-project?rev=339054&view=rev
Log:
[LICM] Add tests highlighting missing hoists for intrinsics [NFC]
Added:
llvm/trunk/test/Transforms/LICM/guards.ll
llvm/trunk/test/Transforms/LICM/invariant.start.ll
Modified:
llvm/trunk/test/Transforms/LICM/assume.ll
Modified: llvm/trunk/test/Transforms/LICM/assume.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LICM/assume.ll?rev=339054&r1=339053&r2=339054&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/LICM/assume.ll (original)
+++ llvm/trunk/test/Transforms/LICM/assume.ll Mon Aug 6 14:06:15 2018
@@ -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
Added: llvm/trunk/test/Transforms/LICM/guards.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LICM/guards.ll?rev=339054&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/LICM/guards.ll (added)
+++ llvm/trunk/test/Transforms/LICM/guards.ll Mon Aug 6 14:06:15 2018
@@ -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, ...)
Added: llvm/trunk/test/Transforms/LICM/invariant.start.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LICM/invariant.start.ll?rev=339054&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/LICM/invariant.start.ll (added)
+++ llvm/trunk/test/Transforms/LICM/invariant.start.ll Mon Aug 6 14:06:15 2018
@@ -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*)
More information about the llvm-commits
mailing list