
We can infer more attribute information once functions are fully simplified, so move the PostOrderFunctionAttrs pass after the function simplification pipeline. However, just doing this can impact simplification of recursive functions since function simplification takes advantage of function attributes of callees (some LLVM tests are actually impacted by this), so keep a copy of PostOrderFunctionAttrs before the function simplification pipeline that only runs on recursive functions. For example, this fixes the small regression noticed in https://reviews.llvm.org/D128830. This requires some restructuring of the CGSCC NoRerun feature. We need to cache the ShouldNotRunFunctionPassesAnalysis analysis after the simplification is done, which now is after the second PostOrderFunctionAttrs run, rather than after the function simplification pipeline. Compile time impact: https://llvm-compile-time-tracker.com/compare.php?from=33cf40122279342b50f92a3a53f5c185390b6018&to=1bb2a07875634e508a6bdf2ca1b130f55510f060&stat=instructions:u Compile time increase from unconditionally running the first PostOrderFunctionAttrs: https://llvm-compile-time-tracker.com/compare.php?from=1bb2a07875634e508a6bdf2ca1b130f55510f060&to=f4f87e89cc7a35c64e3a103a8036192a84ae002b&stat=instructions:u Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D145210
34 lines
771 B
LLVM
34 lines
771 B
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-attributes
|
|
; RUN: opt -O2 -S < %s | FileCheck %s
|
|
|
|
declare void @g()
|
|
|
|
define internal i32 @h1(i32 %a, i32 %b) {
|
|
%c = add i32 %a, %b
|
|
%c2 = add i32 2, %c
|
|
ret i32 %c2
|
|
}
|
|
|
|
define internal i32 @h2(i32 %a, i32 %b) {
|
|
%c = add i32 %a, %b
|
|
%c2 = add i32 2, %c
|
|
ret i32 %c2
|
|
}
|
|
|
|
define void @f(i32 %a, i32 %b) noinline {
|
|
; CHECK: Function Attrs: mustprogress nofree noinline norecurse nosync nounwind willreturn memory(none)
|
|
; CHECK-LABEL: @f(
|
|
; CHECK-NEXT: end:
|
|
; CHECK-NEXT: ret void
|
|
;
|
|
%c = call i32 @h1(i32 %a, i32 %b)
|
|
%d = call i32 @h2(i32 %a, i32 %b)
|
|
%i = icmp eq i32 %c, %d
|
|
br i1 %i, label %end, label %dead
|
|
dead:
|
|
call void @g()
|
|
br label %end
|
|
end:
|
|
ret void
|
|
}
|