1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00
llvm-mirror/test/Transforms/SimplifyCFG/no-md-sink.ll
Bjorn Pettersson 8be96b95c4 [NewPM] Consistently use 'simplifycfg' rather than 'simplify-cfg'
There was an alias between 'simplifycfg' and 'simplify-cfg' in the
PassRegistry. That was the original reason for this patch, which
effectively removes the alias.

This patch also replaces all occurrances of 'simplify-cfg'
by 'simplifycfg'. Reason for choosing that form for the name is
that it matches the DEBUG_TYPE for the pass, and the legacy PM name
and also how it is spelled out in other passes such as
'loop-simplifycfg', and in other options such as
'simplifycfg-merge-cond-stores'.

I for some reason the name should be changed to 'simplify-cfg' in
the future, then I think such a renaming should be more widely done
and not only impacting the PassRegistry.

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D105627
2021-07-09 09:47:03 +02:00

53 lines
1.3 KiB
LLVM

; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -sink-common-insts -S | FileCheck %s
; RUN: opt < %s -passes='simplifycfg<sink-common-insts>' -S | FileCheck %s
define i1 @test1(i1 zeroext %flag, i8* %y) #0 {
entry:
br i1 %flag, label %if.then, label %if.else
if.then:
%r = call i1 @llvm.type.test(i8* %y, metadata !0)
br label %if.end
if.else:
%s = call i1 @llvm.type.test(i8* %y, metadata !1)
br label %if.end
if.end:
%t = phi i1 [ %s, %if.else ], [ %r, %if.then ]
ret i1 %t
}
!0 = !{i32 0, !"typeid1"}
!1 = !{i32 4, !"typeid1"}
declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone
; CHECK-LABEL: test1
; CHECK: @llvm.type.test
; CHECK: @llvm.type.test
; CHECK: ret i1
define i1 @test2(i1 zeroext %flag, i8* %y, i8* %z) #0 {
entry:
br i1 %flag, label %if.then, label %if.else
if.then:
%r = call i1 @llvm.type.test(i8* %y, metadata !0)
br label %if.end
if.else:
%s = call i1 @llvm.type.test(i8* %z, metadata !0)
br label %if.end
if.end:
%t = phi i1 [ %s, %if.else ], [ %r, %if.then ]
ret i1 %t
}
; CHECK-LABEL: test2
; CHECK: %[[S:[a-z0-9.]+]] = select i1 %flag, i8* %y, i8* %z
; CHECK: %[[R:[a-z0-9.]+]] = call i1 @llvm.type.test(i8* %[[S]], metadata ![[MD:[0-9]+]]
; CHECK: ret i1 %[[R]]
; CHECK: ![[MD]] = !{i32 0, !"typeid1"}