• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes
2; RUN: opt < %s -argpromotion -S | FileCheck %s
3; RUN: opt < %s -passes=argpromotion -S | FileCheck %s
4
5@G1 = constant i32 0
6@G2 = constant i32* @G1
7
8define internal i32 @test(i32** %x) {
9; CHECK-LABEL: define {{[^@]+}}@test
10; CHECK-SAME: (i32 [[X_VAL_VAL:%.*]])
11; CHECK-NEXT:  entry:
12; CHECK-NEXT:    ret i32 [[X_VAL_VAL]]
13;
14entry:
15  %y = load i32*, i32** %x
16  %z = load i32, i32* %y
17  ret i32 %z
18}
19
20define i32 @caller() {
21; CHECK-LABEL: define {{[^@]+}}@caller()
22; CHECK-NEXT:  entry:
23; CHECK-NEXT:    [[G2_VAL:%.*]] = load i32*, i32** @G2
24; CHECK-NEXT:    [[G2_VAL_VAL:%.*]] = load i32, i32* [[G2_VAL]]
25; CHECK-NEXT:    [[X:%.*]] = call i32 @test(i32 [[G2_VAL_VAL]])
26; CHECK-NEXT:    ret i32 [[X]]
27;
28entry:
29  %x = call i32 @test(i32** @G2)
30  ret i32 %x
31}
32
33