
The legacy PM is deprecated, so update a bunch of lit tests running opt to use the new PM syntax when specifying the pipeline. In this patch focus has been put on test cases for ConstantMerge, ConstraintElimination, CorrelatedValuePropagation, GlobalDCE, GlobalOpt, SCCP, TailCallElim and PredicateInfo. Differential Revision: https://reviews.llvm.org/D114516
102 lines
2.9 KiB
LLVM
102 lines
2.9 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
; RUN: opt < %s -passes=sccp -S | FileCheck %s
|
|
|
|
define i32 @zext_lshr(i1 %t0) {
|
|
; CHECK-LABEL: @zext_lshr(
|
|
; CHECK-NEXT: [[T1:%.*]] = zext i1 [[T0:%.*]] to i32
|
|
; CHECK-NEXT: ret i32 0
|
|
;
|
|
%t1 = zext i1 %t0 to i32
|
|
%t2 = lshr i32 %t1, 1
|
|
ret i32 %t2
|
|
}
|
|
|
|
define i1 @zext_icmp(i1 %t0) {
|
|
; CHECK-LABEL: @zext_icmp(
|
|
; CHECK-NEXT: [[T1:%.*]] = zext i1 [[T0:%.*]] to i32
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%t1 = zext i1 %t0 to i32
|
|
%t2 = icmp eq i32 %t1, 2
|
|
ret i1 %t2
|
|
}
|
|
|
|
; negative test. SCCP operates poorly with vector ranges
|
|
|
|
define <2 x i1> @zext_vector(<2 x i1> %t0) {
|
|
; CHECK-LABEL: @zext_vector(
|
|
; CHECK-NEXT: [[T1:%.*]] = zext <2 x i1> [[T0:%.*]] to <2 x i32>
|
|
; CHECK-NEXT: [[T2:%.*]] = icmp eq <2 x i32> [[T1]], <i32 2, i32 2>
|
|
; CHECK-NEXT: ret <2 x i1> [[T2]]
|
|
;
|
|
%t1 = zext <2 x i1> %t0 to <2 x i32>
|
|
%t2 = icmp eq <2 x i32> %t1, <i32 2, i32 2>
|
|
ret <2 x i1> %t2
|
|
}
|
|
|
|
; negative test. SCCP operates poorly with vector ranges
|
|
|
|
define <2 x i1> @zext_vector2(<2 x i1> %t0) {
|
|
; CHECK-LABEL: @zext_vector2(
|
|
; CHECK-NEXT: [[T1:%.*]] = zext <2 x i1> [[T0:%.*]] to <2 x i32>
|
|
; CHECK-NEXT: [[T2:%.*]] = add <2 x i32> [[T1]], <i32 2, i32 2>
|
|
; CHECK-NEXT: [[T3:%.*]] = icmp eq <2 x i32> [[T1]], [[T2]]
|
|
; CHECK-NEXT: ret <2 x i1> [[T3]]
|
|
;
|
|
%t1 = zext <2 x i1> %t0 to <2 x i32>
|
|
%t2 = add <2 x i32> %t1, <i32 2, i32 2>
|
|
%t3 = icmp eq <2 x i32> %t1, %t2
|
|
ret <2 x i1> %t3
|
|
}
|
|
|
|
; negative test: %t2 can be replaced by %t1, but SCCP operates by ranges only
|
|
|
|
define i32 @sext_ashr(i1 %t0) {
|
|
; CHECK-LABEL: @sext_ashr(
|
|
; CHECK-NEXT: [[T1:%.*]] = sext i1 [[T0:%.*]] to i32
|
|
; CHECK-NEXT: [[T2:%.*]] = ashr i32 [[T1]], 1
|
|
; CHECK-NEXT: ret i32 [[T2]]
|
|
;
|
|
%t1 = sext i1 %t0 to i32
|
|
%t2 = ashr i32 %t1, 1
|
|
ret i32 %t2
|
|
}
|
|
|
|
define i1 @sext_icmp(i1 %t0) {
|
|
; CHECK-LABEL: @sext_icmp(
|
|
; CHECK-NEXT: [[T1:%.*]] = sext i1 [[T0:%.*]] to i32
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%t1 = sext i1 %t0 to i32
|
|
%t2 = icmp eq i32 %t1, 2
|
|
ret i1 %t2
|
|
}
|
|
|
|
; negative test. SCCP operates poorly with vector ranges
|
|
|
|
define <2 x i1> @sext_vector(<2 x i1> %t0) {
|
|
; CHECK-LABEL: @sext_vector(
|
|
; CHECK-NEXT: [[T1:%.*]] = sext <2 x i1> [[T0:%.*]] to <2 x i32>
|
|
; CHECK-NEXT: [[T2:%.*]] = icmp eq <2 x i32> [[T1]], <i32 2, i32 2>
|
|
; CHECK-NEXT: ret <2 x i1> [[T2]]
|
|
;
|
|
%t1 = sext <2 x i1> %t0 to <2 x i32>
|
|
%t2 = icmp eq <2 x i32> %t1, <i32 2, i32 2>
|
|
ret <2 x i1> %t2
|
|
}
|
|
|
|
; negative test. SCCP operates poorly with vector ranges
|
|
|
|
define <2 x i1> @sext_vector2(<2 x i1> %t0) {
|
|
; CHECK-LABEL: @sext_vector2(
|
|
; CHECK-NEXT: [[T1:%.*]] = sext <2 x i1> [[T0:%.*]] to <2 x i32>
|
|
; CHECK-NEXT: [[T2:%.*]] = add <2 x i32> [[T1]], <i32 2, i32 2>
|
|
; CHECK-NEXT: [[T3:%.*]] = icmp eq <2 x i32> [[T1]], [[T2]]
|
|
; CHECK-NEXT: ret <2 x i1> [[T3]]
|
|
;
|
|
%t1 = sext <2 x i1> %t0 to <2 x i32>
|
|
%t2 = add <2 x i32> %t1, <i32 2, i32 2>
|
|
%t3 = icmp eq <2 x i32> %t1, %t2
|
|
ret <2 x i1> %t3
|
|
}
|