Mehdi Amini | 2d28f7a | 2016-04-16 06:56:44 +0000 | [diff] [blame] | 1 | ; RUN: opt -name-anon-functions -module-summary < %s | llvm-bcanalyzer -dump | FileCheck %s -check-prefix=BC |
Teresa Johnson | 26ab577 | 2016-03-15 00:04:37 +0000 | [diff] [blame] | 2 | ; Check for summary block/records. |
Teresa Johnson | 403a787 | 2015-10-04 14:33:43 +0000 | [diff] [blame] | 3 | |
Teresa Johnson | 26ab577 | 2016-03-15 00:04:37 +0000 | [diff] [blame] | 4 | ; Check the value ids in the summary entries against the |
Teresa Johnson | a9a6307 | 2016-02-01 23:26:30 +0000 | [diff] [blame] | 5 | ; same in the ValueSumbolTable, to ensure the ordering is stable. |
Teresa Johnson | 5e22e44 | 2016-02-06 16:07:35 +0000 | [diff] [blame] | 6 | ; Also check the linkage field on the summary entries. |
Teresa Johnson | 76a1c1d | 2016-03-11 18:52:24 +0000 | [diff] [blame] | 7 | ; BC: <GLOBALVAL_SUMMARY_BLOCK |
| 8 | ; BC-NEXT: <PERMODULE {{.*}} op0=1 op1=0 |
| 9 | ; BC-NEXT: <PERMODULE {{.*}} op0=2 op1=0 |
Mehdi Amini | 2d28f7a | 2016-04-16 06:56:44 +0000 | [diff] [blame] | 10 | ; BC-NEXT: <PERMODULE {{.*}} op0=3 op1=3 |
| 11 | ; BC-NEXT: <ALIAS {{.*}} op0=4 op1=0 op2=3 |
Mehdi Amini | b5b2893 | 2016-04-13 17:20:07 +0000 | [diff] [blame] | 12 | ; BC-NEXT: </GLOBALVAL_SUMMARY_BLOCK |
Teresa Johnson | a9a6307 | 2016-02-01 23:26:30 +0000 | [diff] [blame] | 13 | ; BC-NEXT: <VALUE_SYMTAB |
Mehdi Amini | 2d28f7a | 2016-04-16 06:56:44 +0000 | [diff] [blame] | 14 | ; BC-NEXT: <FNENTRY {{.*}} op0=3 {{.*}}> record string = 'anon. |
Mehdi Amini | b5b2893 | 2016-04-13 17:20:07 +0000 | [diff] [blame] | 15 | ; BC-NEXT: <FNENTRY {{.*}} op0=1 {{.*}}> record string = 'foo' |
Teresa Johnson | a9a6307 | 2016-02-01 23:26:30 +0000 | [diff] [blame] | 16 | ; BC-NEXT: <FNENTRY {{.*}} op0=2 {{.*}}> record string = 'bar' |
| 17 | ; BC-NEXT: <FNENTRY {{.*}} op0=4 {{.*}}> record string = 'f' |
Teresa Johnson | 403a787 | 2015-10-04 14:33:43 +0000 | [diff] [blame] | 18 | |
Mehdi Amini | 2d28f7a | 2016-04-16 06:56:44 +0000 | [diff] [blame] | 19 | ; RUN: opt -name-anon-functions -module-summary < %s | llvm-dis | FileCheck %s |
Teresa Johnson | 403a787 | 2015-10-04 14:33:43 +0000 | [diff] [blame] | 20 | ; Check that this round-trips correctly. |
| 21 | |
| 22 | ; ModuleID = '<stdin>' |
| 23 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 24 | target triple = "x86_64-unknown-linux-gnu" |
| 25 | |
| 26 | ; CHECK: define i32 @foo() |
| 27 | |
| 28 | ; Function Attrs: nounwind uwtable |
| 29 | define i32 @foo() #0 { |
| 30 | entry: |
| 31 | ret i32 1 |
| 32 | } |
| 33 | |
| 34 | ; CHECK: define i32 @bar(i32 %x) |
| 35 | |
| 36 | ; Function Attrs: nounwind uwtable |
| 37 | define i32 @bar(i32 %x) #0 { |
| 38 | entry: |
| 39 | ret i32 %x |
| 40 | } |
| 41 | |
Teresa Johnson | 2d5487c | 2016-04-11 13:58:45 +0000 | [diff] [blame] | 42 | ; FIXME: Anonymous function and alias not currently in summary until |
| 43 | ; follow on fixes to rename anonymous functions and emit alias summary |
| 44 | ; entries are committed. |
Teresa Johnson | 403a787 | 2015-10-04 14:33:43 +0000 | [diff] [blame] | 45 | ; Check an anonymous function as well, since in that case only the alias |
| 46 | ; ends up in the value symbol table and having a summary. |
| 47 | @f = alias void (), void ()* @0 ; <void ()*> [#uses=0] |
| 48 | @h = external global void ()* ; <void ()*> [#uses=0] |
| 49 | |
| 50 | define internal void @0() nounwind { |
| 51 | entry: |
| 52 | store void()* @0, void()** @h |
| 53 | br label %return |
| 54 | |
| 55 | return: ; preds = %entry |
| 56 | ret void |
| 57 | } |