[llvm] r339057 - [LICM] Strengthen invariant.start hoisting tests [NFC]
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 6 14:18:34 PDT 2018
Author: reames
Date: Mon Aug 6 14:18:34 2018
New Revision: 339057
URL: http://llvm.org/viewvc/llvm-project?rev=339057&view=rev
Log:
[LICM] Strengthen invariant.start hoisting tests [NFC]
Modified:
llvm/trunk/test/Transforms/LICM/invariant.start.ll
Modified: llvm/trunk/test/Transforms/LICM/invariant.start.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LICM/invariant.start.ll?rev=339057&r1=339056&r2=339057&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/LICM/invariant.start.ll (original)
+++ llvm/trunk/test/Transforms/LICM/invariant.start.ll Mon Aug 6 14:18:34 2018
@@ -20,4 +20,46 @@ loop:
br label %loop
}
+;; TODO: despite the loop varying invariant.start, we should be
+;; able to hoist the load
+define void @test2(i1 %cond, i32* %ptr) {
+; CHECK-LABEL: @test2(
+; CHECK-LABEL: entry:
+; CHECK-LABEL: loop:
+; CHECK: call {}* @llvm.invariant.start.p0i32(i64 4, i32* %piv)
+; CHECK: %val = load i32, i32* %ptr
+
+entry:
+ br label %loop
+
+loop:
+ %x = phi i32 [ 0, %entry ], [ %x.inc, %loop ]
+ %piv = getelementptr i32, i32* %ptr, i32 %x
+ call {}* @llvm.invariant.start.p0i32(i64 4, i32* %piv)
+ %val = load i32, i32* %ptr
+ %x.inc = add i32 %x, %val
+ br label %loop
+}
+
+; Should be able to hoist since store doesn't alias
+define void @test3(i1 %cond, i32* %ptr) {
+; CHECK-LABEL: @test3(
+; 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
+ %p2 = getelementptr i32, i32* %ptr, i32 1
+ store volatile i32 0, i32* %p2
+ %x.inc = add i32 %x, %val
+ br label %loop
+}
+
declare {}* @llvm.invariant.start.p0i32(i64, i32*)
More information about the llvm-commits
mailing list