[LoongArch] Fix the assertion for atomic store with 'ptr' type
[llvm-project.git] / llvm / test / Transforms / ConstraintElimination / gep-constexpr.ll
blobcd57e0713417b15633b97d9ebe502dde0c5249e0
1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=constraint-elimination -S %s | FileCheck %s
4 declare void @llvm.assume(i1 noundef) #0
6 @arr1 = common global [3 x i16] zeroinitializer, align 2
8 define i1 @gep_constexpr_index_lt_upper(i32 noundef %i) {
9 ; CHECK-LABEL: @gep_constexpr_index_lt_upper(
10 ; CHECK-NEXT:  entry:
11 ; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i32 [[I:%.*]], 3
12 ; CHECK-NEXT:    call void @llvm.assume(i1 [[CMP]])
13 ; CHECK-NEXT:    [[IDXPROM:%.*]] = zext i32 [[I]] to i64
14 ; CHECK-NEXT:    [[UPPER:%.*]] = getelementptr inbounds i16, ptr @arr1, i64 [[IDXPROM]]
15 ; CHECK-NEXT:    ret i1 true
17 entry:
18   %cmp = icmp ult i32 %i, 3
19   call void @llvm.assume(i1 %cmp)
20   %idxprom = zext i32 %i to i64
21   %upper = getelementptr inbounds i16, ptr @arr1, i64 %idxprom
22   %c.1 = icmp ult ptr %upper, getelementptr inbounds ([3 x i16], ptr @arr1, i64 1, i64 0)
23   ret i1 %c.1
26 define i1 @gep_constexpr_index_may_be_gt_upper(i32 noundef %i) {
27 ; CHECK-LABEL: @gep_constexpr_index_may_be_gt_upper(
28 ; CHECK-NEXT:  entry:
29 ; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i32 [[I:%.*]], 3
30 ; CHECK-NEXT:    call void @llvm.assume(i1 [[CMP]])
31 ; CHECK-NEXT:    [[IDXPROM:%.*]] = zext i32 [[I]] to i64
32 ; CHECK-NEXT:    [[UPPER:%.*]] = getelementptr inbounds i16, ptr @arr1, i64 [[IDXPROM]]
33 ; CHECK-NEXT:    [[C_1:%.*]] = icmp ult ptr [[UPPER]], getelementptr inbounds ([3 x i16], ptr @arr1, i64 0, i64 2)
34 ; CHECK-NEXT:    ret i1 [[C_1]]
36 entry:
37   %cmp = icmp ult i32 %i, 3
38   call void @llvm.assume(i1 %cmp)
39   %idxprom = zext i32 %i to i64
40   %upper = getelementptr inbounds i16, ptr @arr1, i64 %idxprom
41   %c.1 = icmp ult ptr %upper, getelementptr inbounds ([3 x i16], ptr @arr1, i64 0, i64 2)
42   ret i1 %c.1