brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.1 KiB · a02e2c3 Raw
101 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 42; RUN: opt -p argpromotion -S %s | FileCheck %s3 4target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"5 6@f = dso_local global { i16, i64 } { i16 1, i64 0 }, align 87 8; Test case for https://github.com/llvm/llvm-project/issues/84807.9 10; Make sure the loads from @callee are not moved to @caller, as the store11; in %then may aliases to load from %q.12 13define i32 @caller1(i1 %c) {14; CHECK-LABEL: define i32 @caller1(15; CHECK-SAME: i1 [[C:%.*]]) {16; CHECK-NEXT:  entry:17; CHECK-NEXT:    call void @callee1(ptr noundef nonnull @f, i1 [[C]])18; CHECK-NEXT:    ret i32 019;20entry:21  call void @callee1(ptr noundef nonnull @f, i1 %c)22  ret i32 023}24 25define internal void @callee1(ptr nocapture noundef readonly %q, i1 %c) {26; CHECK-LABEL: define internal void @callee1(27; CHECK-SAME: ptr noundef readonly captures(none) [[Q:%.*]], i1 [[C:%.*]]) {28; CHECK-NEXT:  entry:29; CHECK-NEXT:    br i1 [[C]], label [[THEN:%.*]], label [[EXIT:%.*]]30; CHECK:       then:31; CHECK-NEXT:    store i16 123, ptr @f, align 832; CHECK-NEXT:    br label [[EXIT]]33; CHECK:       exit:34; CHECK-NEXT:    [[Q_0_VAL:%.*]] = load i16, ptr [[Q]], align 835; CHECK-NEXT:    [[GEP_8:%.*]] = getelementptr inbounds i8, ptr [[Q]], i64 836; CHECK-NEXT:    [[Q_8_VAL:%.*]] = load i64, ptr [[GEP_8]], align 837; CHECK-NEXT:    call void @use(i16 [[Q_0_VAL]], i64 [[Q_8_VAL]])38; CHECK-NEXT:    ret void39;40entry:41  br i1 %c, label %then, label %exit42 43then:44  store i16 123, ptr @f, align 845  br label %exit46 47exit:48  %l.0 = load i16, ptr %q, align 849  %gep.8  = getelementptr inbounds i8, ptr %q, i64 850  %l.1 = load i64, ptr %gep.8, align 851  call void @use(i16 %l.0, i64 %l.1)52  ret void53 54  uselistorder ptr %q, { 1, 0 }55}56 57; Same as @caller1/callee2, but with default uselist order.58define i32 @caller2(i1 %c) {59; CHECK-LABEL: define i32 @caller2(60; CHECK-SAME: i1 [[C:%.*]]) {61; CHECK-NEXT:  entry:62; CHECK-NEXT:    call void @callee2(ptr noundef nonnull @f, i1 [[C]])63; CHECK-NEXT:    ret i32 064;65entry:66  call void @callee2(ptr noundef nonnull @f, i1 %c)67  ret i32 068}69 70define internal void @callee2(ptr nocapture noundef readonly %q, i1 %c) {71; CHECK-LABEL: define internal void @callee2(72; CHECK-SAME: ptr noundef readonly captures(none) [[Q:%.*]], i1 [[C:%.*]]) {73; CHECK-NEXT:  entry:74; CHECK-NEXT:    br i1 [[C]], label [[THEN:%.*]], label [[EXIT:%.*]]75; CHECK:       then:76; CHECK-NEXT:    store i16 123, ptr @f, align 877; CHECK-NEXT:    br label [[EXIT]]78; CHECK:       exit:79; CHECK-NEXT:    [[Q_0_VAL:%.*]] = load i16, ptr [[Q]], align 880; CHECK-NEXT:    [[GEP_8:%.*]] = getelementptr inbounds i8, ptr [[Q]], i64 881; CHECK-NEXT:    [[Q_8_VAL:%.*]] = load i64, ptr [[GEP_8]], align 882; CHECK-NEXT:    call void @use(i16 [[Q_0_VAL]], i64 [[Q_8_VAL]])83; CHECK-NEXT:    ret void84;85entry:86  br i1 %c, label %then, label %exit87 88then:89  store i16 123, ptr @f, align 890  br label %exit91 92exit:93  %l.0 = load i16, ptr %q, align 894  %gep.8  = getelementptr inbounds i8, ptr %q, i64 895  %l.1 = load i64, ptr %gep.8, align 896  call void @use(i16 %l.0, i64 %l.1)97  ret void98}99 100declare void @use(i16, i64)101