1 ; RUN: opt -S -passes=licm %s | FileCheck %s
3 ; Volatile register shouldn't be hoisted ourside loops.
4 define i32 @test_read() {
5 ; CHECK-LABEL: define i32 @test_read()
6 ; CHECK: br label %loop
8 ; CHECK: %counter = tail call i64 @llvm.read_volatile_register
14 %i = phi i32 [ 0, %entry ], [ %i.next, %inc ]
15 %counter = tail call i64 @llvm.read_volatile_register.i64(metadata !1)
16 %tst = icmp ult i64 %counter, 1000
17 br i1 %tst, label %inc, label %done
20 %i.next = add nuw nsw i32 %i, 1
27 declare i64 @llvm.read_register.i64(metadata)
28 declare i64 @llvm.read_volatile_register.i64(metadata)