1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00
llvm-mirror/test/Transforms/InstMerge/exceptions.ll
Davide Italiano af24ebdbb8 [PM] Port MergedLoadStoreMotion to the new pass manager, take two.
This is indeed a much cleaner approach (thanks to Daniel Berlin
for pointing out), and also David/Sean for review.

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

llvm-svn: 273032
2016-06-17 19:10:09 +00:00

62 lines
2.1 KiB
LLVM

; RUN: opt -basicaa -memdep -mldst-motion -S < %s | FileCheck %s
; RUN: opt -aa-pipeline=basic-aa -passes='require<memdep>',mldst-motion \
; RUN: -S < %s | FileCheck %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@r = common global i32 0, align 4
@s = common global i32 0, align 4
; CHECK-LABEL: define void @test1(
define void @test1(i1 %cmp, i32* noalias %p) {
entry:
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
call void @may_exit() nounwind
%arrayidx = getelementptr inbounds i32, i32* %p, i64 1
%0 = load i32, i32* %arrayidx, align 4
store i32 %0, i32* @r, align 4
br label %if.end
; CHECK: call void @may_exit()
; CHECK-NEXT: %[[gep:.*]] = getelementptr inbounds i32, i32* %p, i64 1
; CHECK-NEXT: %[[load:.*]] = load i32, i32* %[[gep]], align 4
; CHECK-NEXT: store i32 %[[load]], i32* @r, align 4
if.else: ; preds = %entry
%arrayidx1 = getelementptr inbounds i32, i32* %p, i64 1
%1 = load i32, i32* %arrayidx1, align 4
store i32 %1, i32* @s, align 4
br label %if.end
if.end: ; preds = %if.else, %if.then
ret void
}
; CHECK-LABEL: define void @test2(
define void @test2(i1 %cmp, i32* noalias %p) {
entry:
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%arrayidx = getelementptr inbounds i32, i32* %p, i64 1
store i32 1, i32* %arrayidx, align 4
call void @may_throw()
; CHECK: %[[gep:.*]] = getelementptr inbounds i32, i32* %p, i64 1
; CHECK-NEXT: store i32 1, i32* %[[gep]], align 4
; CHECK-NEXT: call void @may_throw()
br label %if.end
if.else: ; preds = %entry
%arrayidx1 = getelementptr inbounds i32, i32* %p, i64 1
store i32 2, i32* %arrayidx1, align 4
br label %if.end
if.end: ; preds = %if.else, %if.then
ret void
}
declare void @may_throw()
declare void @may_exit() nounwind