1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00
llvm-mirror/test/Transforms/SimplifyCFG/preserve-llvm-loop-metadata.ll
Sanjay Patel ab3266d1be [SimplifyCFG] use pass options and remove the latesimplifycfg pass
This is no-functional-change-intended.

This is repackaging the functionality of D30333 (defer switch-to-lookup-tables) and 
D35411 (defer folding unconditional branches) with pass parameters rather than a named
"latesimplifycfg" pass. Now that we have individual options to control the functionality,
we could decouple when these fire (but that's an independent patch if desired). 

The next planned step would be to add another option bit to disable the sinking transform
mentioned in D38566. This should also make it clear that the new pass manager needs to
be updated to limit simplifycfg in the same way as the old pass manager.

Differential Revision: https://reviews.llvm.org/D38631

llvm-svn: 316835
2017-10-28 18:43:07 +00:00

54 lines
1.6 KiB
LLVM

; RUN: opt -simplifycfg -keep-loops=false -S < %s | FileCheck %s
define void @test1(i32 %n) #0 {
entry:
%n.addr = alloca i32, align 4
%count = alloca i32, align 4
store i32 %n, i32* %n.addr, align 4
%0 = bitcast i32* %count to i8*
store i32 0, i32* %count, align 4
br label %while.cond
while.cond: ; preds = %if.end, %entry
%1 = load i32, i32* %count, align 4
%2 = load i32, i32* %n.addr, align 4
%cmp = icmp ule i32 %1, %2
br i1 %cmp, label %while.body, label %while.end
while.body: ; preds = %while.cond
%3 = load i32, i32* %count, align 4
%rem = urem i32 %3, 2
%cmp1 = icmp eq i32 %rem, 0
br i1 %cmp1, label %if.then, label %if.else
if.then: ; preds = %while.body
%4 = load i32, i32* %count, align 4
%add = add i32 %4, 1
store i32 %add, i32* %count, align 4
br label %if.end
; CHECK: if.then:
; CHECK: br label %while.cond, !llvm.loop !0
if.else: ; preds = %while.body
%5 = load i32, i32* %count, align 4
%add2 = add i32 %5, 2
store i32 %add2, i32* %count, align 4
br label %if.end
; CHECK: if.else:
; CHECK: br label %while.cond, !llvm.loop !0
if.end: ; preds = %if.else, %if.then
br label %while.cond, !llvm.loop !0
while.end: ; preds = %while.cond
%6 = bitcast i32* %count to i8*
ret void
}
!0 = distinct !{!0, !1}
!1 = !{!"llvm.loop.distribute.enable", i1 true}
; CHECK: !0 = distinct !{!0, !1}
; CHECK: !1 = !{!"llvm.loop.distribute.enable", i1 true}