brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 25ed62c Raw
44 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes2; RUN: opt < %s -passes=argpromotion -S | FileCheck %s3; PR24984 5; This test tries to convince CHECK about promoting the load from %A + 2,6; because there is a load of %A in the entry block7define internal i32 @callee(i1 %C, ptr %A) {8; CHECK-LABEL: define {{[^@]+}}@callee9; CHECK-SAME: (i1 [[C:%.*]], ptr [[A:%.*]]) {10; CHECK-NEXT:  entry:11; CHECK-NEXT:    [[A_0:%.*]] = load i32, ptr [[A]], align 412; CHECK-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]13; CHECK:       T:14; CHECK-NEXT:    ret i32 [[A_0]]15; CHECK:       F:16; CHECK-NEXT:    [[A_2:%.*]] = getelementptr i32, ptr [[A]], i32 217; CHECK-NEXT:    [[R:%.*]] = load i32, ptr [[A_2]], align 418; CHECK-NEXT:    ret i32 [[R]]19;20entry:21  ; Unconditonally load the element at %A22  %A.0 = load i32, ptr %A23  br i1 %C, label %T, label %F24 25T:26  ret i32 %A.027 28F:29  ; Load the element at offset two from %A. This should not be promoted!30  %A.2 = getelementptr i32, ptr %A, i32 231  %R = load i32, ptr %A.232  ret i32 %R33}34 35define i32 @foo() {36; CHECK-LABEL: define {{[^@]+}}@foo() {37; CHECK-NEXT:    [[X:%.*]] = call i32 @callee(i1 false, ptr null)38; CHECK-NEXT:    ret i32 [[X]]39;40  %X = call i32 @callee(i1 false, ptr null)             ; <i32> [#uses=1]41  ret i32 %X42}43 44