llvm-project/llvm/test/Transforms/SCCP/ipsccp-predicated.ll

69 lines
1.6 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -ipsccp -S | FileCheck %s
define i32 @test1(i32 %v) {
; CHECK-LABEL: @test1(
; CHECK-NEXT: Entry:
; CHECK-NEXT: [[TOBOOL1:%.*]] = icmp eq i32 [[V:%.*]], 10
; CHECK-NEXT: br i1 [[TOBOOL1]], label [[T:%.*]], label [[F:%.*]]
; CHECK: T:
; CHECK-NEXT: [[R:%.*]] = call i32 @callee(i32 20)
; CHECK-NEXT: ret i32 [[R]]
; CHECK: F:
; CHECK-NEXT: [[X:%.*]] = call i32 @callee(i32 [[V]])
; CHECK-NEXT: ret i32 [[X]]
;
Entry:
%tobool1 = icmp eq i32 %v, 10
br i1 %tobool1, label %T, label %F
T:
%a = add i32 %v, 10
%r = call i32 @callee(i32 %a)
ret i32 %r
F:
%x = call i32 @callee(i32 %v)
ret i32 %x
}
define internal i32 @test2(i32 %v, i32 %c) {
; CHECK-LABEL: @test2(
; CHECK-NEXT: Entry:
; CHECK-NEXT: [[TOBOOL1:%.*]] = icmp eq i32 [[V:%.*]], 99
; CHECK-NEXT: br i1 [[TOBOOL1]], label [[T:%.*]], label [[F:%.*]]
; CHECK: T:
; CHECK-NEXT: [[R:%.*]] = call i32 @callee(i32 109)
; CHECK-NEXT: ret i32 [[R]]
; CHECK: F:
; CHECK-NEXT: [[X:%.*]] = call i32 @callee(i32 [[V]])
; CHECK-NEXT: ret i32 [[X]]
;
Entry:
%tobool1 = icmp eq i32 %v, %c
br i1 %tobool1, label %T, label %F
T:
%a = add i32 %v, 10
%r = call i32 @callee(i32 %a)
ret i32 %r
F:
%x = call i32 @callee(i32 %v)
ret i32 %x
}
define i32 @caller_test2(i32 %v) {
; CHECK-LABEL: @caller_test2(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[R:%.*]] = call i32 @test2(i32 [[V:%.*]], i32 99)
; CHECK-NEXT: ret i32 [[R]]
;
entry:
%r = call i32 @test2(i32 %v, i32 99)
ret i32 %r
}
declare i32 @callee(i32)