[LICM] Add tests from D50786 [NFC]

Exercise more use of volatiles to illustrate that nothing changes as we tweak how we detect them.

llvm-svn: 340244
This commit is contained in:
Philip Reames 2018-08-21 00:42:07 +00:00
parent efdd0a426a
commit 578c64da0c
2 changed files with 34 additions and 0 deletions

View File

@ -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

View File

@ -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(