[llvm] r340244 - [LICM] Add tests from D50786 [NFC]
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 20 17:42:07 PDT 2018
Author: reames
Date: Mon Aug 20 17:42:07 2018
New Revision: 340244
URL: http://llvm.org/viewvc/llvm-project?rev=340244&view=rev
Log:
[LICM] Add tests from D50786 [NFC]
Exercise more use of volatiles to illustrate that nothing changes as we tweak how we detect them.
Modified:
llvm/trunk/test/Transforms/LICM/hoisting.ll
llvm/trunk/test/Transforms/LICM/scalar-promote.ll
Modified: llvm/trunk/test/Transforms/LICM/hoisting.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LICM/hoisting.ll?rev=340244&r1=340243&r2=340244&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/LICM/hoisting.ll (original)
+++ llvm/trunk/test/Transforms/LICM/hoisting.ll Mon Aug 20 17:42:07 2018
@@ -150,6 +150,23 @@ return:
ret i32 %sum
}
+; Can neither sink nor hoist
+define i32 @test_volatile(i1 %c) {
+; CHECK-LABEL: @test_volatile(
+; CHECK-LABEL: Loop:
+; CHECK: load volatile i32, i32* @X
+; CHECK-LABEL: Out:
+ br label %Loop
+
+Loop:
+ %A = load volatile i32, i32* @X
+ br i1 %c, label %Loop, label %Out
+
+Out:
+ ret i32 %A
+}
+
+
declare {}* @llvm.invariant.start.p0i8(i64, i8* nocapture) nounwind readonly
declare void @llvm.invariant.end.p0i8({}*, i64, i8* nocapture) nounwind
declare void @escaping.invariant.start({}*) nounwind
Modified: llvm/trunk/test/Transforms/LICM/scalar-promote.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LICM/scalar-promote.ll?rev=340244&r1=340243&r2=340244&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/LICM/scalar-promote.ll (original)
+++ llvm/trunk/test/Transforms/LICM/scalar-promote.ll Mon Aug 20 17:42:07 2018
@@ -74,6 +74,23 @@ Out: ; preds = %Loop
ret void
}
+define void @test3b(i32 %i) {
+; CHECK-LABEL: @test3b(
+; CHECK-LABEL: Loop:
+; CHECK: store volatile
+; CHECK-LABEL: Out:
+ br label %Loop
+Loop:
+ ; Should not promote this to a register
+ %x = load i32, i32* @X
+ %x2 = add i32 %x, 1
+ store volatile i32 %x2, i32* @X
+ br i1 true, label %Out, label %Loop
+
+Out: ; preds = %Loop
+ ret void
+}
+
; PR8041
define void @test4(i8* %x, i8 %n) {
; CHECK-LABEL: @test4(
More information about the llvm-commits
mailing list