llvm-mirror/test/Transforms/Attributor/new_attributes.ll
Johannes Doerfert dd4a1a3fb6 [Attributor][FIX] Record dependences for assumed dead abstract attributes
In a recent patch we introduced a problem with abstract attributes that
were assumed dead at some point. Since `Attributor::updateAA` was
introduced in 95e0d28b71e42c9b7cd77c96f728311981a021f6, we did not
remember the dependence on the liveness AA when an abstract attribute
was assumed dead and therefore not updated.

Explicit reproducer added in liveness.ll.

---

Single run of the Attributor module and then CGSCC pass (oldPM)
for SPASS/clause.c (~10k LLVM-IR loc):

Before:
```
calls to allocation functions: 509242 (345483/s)
temporary memory allocations: 98666 (66937/s)
peak heap memory consumption: 18.60MB
peak RSS (including heaptrack overhead): 103.29MB
total memory leaked: 269.10KB
```

After:
```
calls to allocation functions: 529332 (355494/s)
temporary memory allocations: 102107 (68574/s)
peak heap memory consumption: 19.40MB
peak RSS (including heaptrack overhead): 102.79MB
total memory leaked: 269.10KB
```

Difference:
```
calls to allocation functions: 20090 (1339333/s)
temporary memory allocations: 3441 (229400/s)
peak heap memory consumption: 801.45KB
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B
```
2020-05-07 17:00:50 -05:00

42 lines
1.2 KiB
LLVM

; RUN: opt < %s -attributor -attributor-annotate-decl-cs -attributor-max-iterations=2 -S | FileCheck %s
; RUN: opt < %s -attributor -attributor-annotate-decl-cs -attributor-max-iterations=3 -S | FileCheck %s
; RUN: opt < %s -attributor -attributor-annotate-decl-cs -attributor-max-iterations=4 -S | FileCheck %s
; RUN: opt < %s -attributor -attributor-annotate-decl-cs -attributor-max-iterations=2147483647 -S | FileCheck %s
; CHECK-NOT: Function
; CHECK: declare i32 @foo1()
; CHECK-NOT: Function
; CHECK: declare i32 @foo2()
; CHECK-NOT: Function
; CHECK: declare i32 @foo3()
declare i32 @foo1()
declare i32 @foo2()
declare i32 @foo3()
; CHECK-NOT: Function
; CHECK: define internal i32 @bar() {
; CHECK-NEXT: %1 = call i32 @foo1()
; CHECK-NEXT: %2 = call i32 @foo2()
; CHECK-NEXT: %3 = call i32 @foo3()
; CHECK-NEXT: ret i32 undef
; CHECK-NEXT: }
define internal i32 @bar() {
%1 = call i32 @foo1()
%2 = call i32 @foo2()
%3 = call i32 @foo3()
ret i32 1
}
; CHECK-NOT: Function
; CHECK: define i32 @baz() {
; CHECK-NEXT: %1 = call i32 @bar()
; CHECK-NEXT: ret i32 0
; CHECK-NEXT: }
define i32 @baz() {
%1 = call i32 @bar()
ret i32 0
}
; We should never derive anything here
; CHECK-NOT: attributes