Files
clang-p2996/llvm/test/Transforms/CalledValuePropagation/simple-select.ll
Bjorn Pettersson 3f8027fb67 [test] Update some test cases to use -passes when specifying the pipeline
This updates transform test cases for
  ADCE
  AddDiscriminators
  AggressiveInstCombine
  AlignmentFromAssumptions
  ArgumentPromotion
  BDCE
  CalledValuePropagation
  DCE
  Reg2Mem
  WholeProgramDevirt
to use the -passes syntax when specifying the pipeline.

Given that LLVM_ENABLE_NEW_PASS_MANAGER isn't set to off (which is
a deprecated feature) the updated test cases already used the new
pass manager, but they were using the legacy syntax when specifying
the passes to run. This patch can be seen as a step toward deprecating
that interface.

This patch also removes some redundant RUN lines. Here I am
referring to test cases that had multiple RUN lines verifying both
the legacy "-passname" syntax and the new "-passes=passname" syntax.
Since we switched the default pass manager to "new PM" both RUN lines
have verified the new PM version of the pass (more or less wasting
time running the same test twice), unless LLVM_ENABLE_NEW_PASS_MANAGER
is set to "off". It is assumed that it is enough to run these tests
with the new pass manager now.

Differential Revision: https://reviews.llvm.org/D108472
2021-09-29 21:51:08 +02:00

40 lines
1.4 KiB
LLVM

; RUN: opt -passes=called-value-propagation -S < %s | FileCheck %s
target triple = "aarch64-unknown-linux-gnueabi"
@global_function = internal unnamed_addr global void ()* null, align 8
@global_scalar = internal unnamed_addr global i64 zeroinitializer
; This test checks that we propagate the functions through a select
; instruction, and attach !callees metadata to the call. Such metadata can
; enable optimizations of this code sequence.
;
; For example, since both of the targeted functions have the "norecurse"
; attribute, the function attributes pass can be made to infer that
; "@test_select" is also norecurse. This would allow the globals optimizer to
; localize "@global_scalar". The function could then be further simplified to
; always return the constant "1", eliminating the load and store instructions.
;
; CHECK: call void %tmp0(), !callees ![[MD:[0-9]+]]
; CHECK: ![[MD]] = !{void ()* @norecurse_1, void ()* @norecurse_2}
;
define i64 @test_select_entry(i1 %flag) {
entry:
%tmp0 = call i64 @test_select(i1 %flag)
ret i64 %tmp0
}
define internal i64 @test_select(i1 %flag) {
entry:
%tmp0 = select i1 %flag, void ()* @norecurse_1, void ()* @norecurse_2
store i64 1, i64* @global_scalar
call void %tmp0()
%tmp1 = load i64, i64* @global_scalar
ret i64 %tmp1
}
declare void @norecurse_1() #0
declare void @norecurse_2() #0
attributes #0 = { norecurse }