llvm-6502/test/Transforms/SimplifyCFG/trapping-load-unreachable.ll
David Blaikie 7c9c6ed761 [opaque pointer type] Add textual IR support for explicit type parameter to load instruction
Essentially the same as the GEP change in r230786.

A similar migration script can be used to update test cases, though a few more
test case improvements/changes were required this time around: (r229269-r229278)

import fileinput
import sys
import re

pat = re.compile(r"((?:=|:|^)\s*load (?:atomic )?(?:volatile )?(.*?))(| addrspace\(\d+\) *)\*($| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$)")

for line in sys.stdin:
  sys.stdout.write(re.sub(pat, r"\1, \2\3*\4", line))

Reviewers: rafael, dexonsmith, grosser

Differential Revision: http://reviews.llvm.org/D7649

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230794 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-27 21:17:42 +00:00

88 lines
1.7 KiB
LLVM

; RUN: opt < %s -simplifycfg -S | FileCheck %s
; PR2967
target datalayout =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32"
target triple = "i386-pc-linux-gnu"
define void @test1(i32 %x) nounwind {
entry:
%0 = icmp eq i32 %x, 0 ; <i1> [#uses=1]
br i1 %0, label %bb, label %return
bb: ; preds = %entry
%1 = load volatile i32, i32* null
unreachable
br label %return
return: ; preds = %entry
ret void
; CHECK-LABEL: @test1(
; CHECK: load volatile
}
; rdar://7958343
define void @test2() nounwind {
entry:
store i32 4,i32* null
ret void
; CHECK-LABEL: @test2(
; CHECK: call void @llvm.trap
; CHECK: unreachable
}
; PR7369
define void @test3() nounwind {
entry:
store volatile i32 4, i32* null
ret void
; CHECK-LABEL: @test3(
; CHECK: store volatile i32 4, i32* null
; CHECK: ret
}
; Check store before unreachable.
define void @test4(i1 %C, i32* %P) {
; CHECK-LABEL: @test4(
; CHECK: entry:
; CHECK-NEXT: br i1 %C
entry:
br i1 %C, label %T, label %F
T:
store volatile i32 0, i32* %P
unreachable
F:
ret void
}
; Check cmpxchg before unreachable.
define void @test5(i1 %C, i32* %P) {
; CHECK-LABEL: @test5(
; CHECK: entry:
; CHECK-NEXT: br i1 %C
entry:
br i1 %C, label %T, label %F
T:
cmpxchg volatile i32* %P, i32 0, i32 1 seq_cst seq_cst
unreachable
F:
ret void
}
; Check atomicrmw before unreachable.
define void @test6(i1 %C, i32* %P) {
; CHECK-LABEL: @test6(
; CHECK: entry:
; CHECK-NEXT: br i1 %C
entry:
br i1 %C, label %T, label %F
T:
atomicrmw volatile xchg i32* %P, i32 0 seq_cst
unreachable
F:
ret void
}