brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.9 KiB · dca1a1e Raw
63 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals2; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal  -attributor-annotate-decl-cs  -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT3; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal  -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC4; PR24985 6; This test tries to convince CHECK about promoting the load from %A + 2,7; because there is a load of %A in the entry block8define internal i32 @callee(i1 %C, ptr %A) {9;10; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read)11; CHECK-LABEL: define {{[^@]+}}@callee12; CHECK-SAME: (ptr nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[A:%.*]]) #[[ATTR0:[0-9]+]] {13; CHECK-NEXT:  entry:14; CHECK-NEXT:    [[A_0:%.*]] = load i32, ptr [[A]], align 415; CHECK-NEXT:    br label [[F:%.*]]16; CHECK:       T:17; CHECK-NEXT:    unreachable18; CHECK:       F:19; CHECK-NEXT:    [[A_2:%.*]] = getelementptr i32, ptr [[A]], i32 220; CHECK-NEXT:    [[R:%.*]] = load i32, ptr [[A_2]], align 421; CHECK-NEXT:    ret i32 [[R]]22;23entry:24  ; Unconditonally load the element at %A25  %A.0 = load i32, ptr %A26  br i1 %C, label %T, label %F27 28T:29  ret i32 %A.030 31F:32  ; Load the element at offset two from %A. This should not be promoted!33  %A.2 = getelementptr i32, ptr %A, i32 234  %R = load i32, ptr %A.235  ret i32 %R36}37 38define i32 @foo(ptr %A) {39; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read)40; TUNIT-LABEL: define {{[^@]+}}@foo41; TUNIT-SAME: (ptr nofree readonly captures(none) [[A:%.*]]) #[[ATTR0]] {42; TUNIT-NEXT:    [[X:%.*]] = call i32 @callee(ptr nofree noundef readonly align 4 captures(none) [[A]]) #[[ATTR1:[0-9]+]]43; TUNIT-NEXT:    ret i32 [[X]]44;45; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: read)46; CGSCC-LABEL: define {{[^@]+}}@foo47; CGSCC-SAME: (ptr nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[A:%.*]]) #[[ATTR1:[0-9]+]] {48; CGSCC-NEXT:    [[X:%.*]] = call i32 @callee(ptr nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[A]]) #[[ATTR2:[0-9]+]]49; CGSCC-NEXT:    ret i32 [[X]]50;51  %X = call i32 @callee(i1 false, ptr %A)             ; <i32> [#uses=1]52  ret i32 %X53}54 55;.56; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) }57; TUNIT: attributes #[[ATTR1]] = { nofree nosync nounwind willreturn memory(read) }58;.59; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) }60; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree nosync nounwind willreturn memory(argmem: read) }61; CGSCC: attributes #[[ATTR2]] = { nofree willreturn memory(read) }62;.63