1; RUN: opt -called-value-propagation -S < %s | FileCheck %s 2 3target triple = "aarch64-unknown-linux-gnueabi" 4 5@global_function = internal unnamed_addr global void ()* null, align 8 6@global_scalar = internal unnamed_addr global i64 zeroinitializer 7 8; This test checks that we propagate the functions through a select 9; instruction, and attach !callees metadata to the call. Such metadata can 10; enable optimizations of this code sequence. 11; 12; For example, since both of the targeted functions have the "norecurse" 13; attribute, the function attributes pass can be made to infer that 14; "@test_select" is also norecurse. This would allow the globals optimizer to 15; localize "@global_scalar". The function could then be further simplified to 16; always return the constant "1", eliminating the load and store instructions. 17; 18; CHECK: call void %tmp0(), !callees ![[MD:[0-9]+]] 19; CHECK: ![[MD]] = !{void ()* @norecurse_1, void ()* @norecurse_2} 20; 21define i64 @test_select_entry(i1 %flag) { 22entry: 23 %tmp0 = call i64 @test_select(i1 %flag) 24 ret i64 %tmp0 25} 26 27define internal i64 @test_select(i1 %flag) { 28entry: 29 %tmp0 = select i1 %flag, void ()* @norecurse_1, void ()* @norecurse_2 30 store i64 1, i64* @global_scalar 31 call void %tmp0() 32 %tmp1 = load i64, i64* @global_scalar 33 ret i64 %tmp1 34} 35 36declare void @norecurse_1() #0 37declare void @norecurse_2() #0 38 39attributes #0 = { norecurse } 40