|
| 1 | +;; Test that the string pooling pass does not pool globals that are |
| 2 | +;; in llvm.used or in llvm.compiler.used. |
| 3 | + |
| 4 | +; RUN: llc -verify-machineinstrs -mcpu=pwr8 -mtriple powerpc-ibm-aix-xcoff -data-sections=false < %s | \ |
| 5 | +; RUN: FileCheck %s |
| 6 | + |
| 7 | +; RUN: llc -verify-machineinstrs -mcpu=pwr8 -mtriple powerpc64-ibm-aix-xcoff -data-sections=false < %s | \ |
| 8 | +; RUN: FileCheck %s |
| 9 | + |
| 10 | +@keep_this = internal constant [5 x i8] c"keep1", align 1 |
| 11 | +@keep_this2 = internal constant [5 x i8] c"keep2", align 1 |
| 12 | +@.str.1 = private unnamed_addr constant [12 x i8] c"str1_STRING\00", align 1 |
| 13 | +@.str.2 = private unnamed_addr constant [12 x i8] c"str2_STRING\00", align 1 |
| 14 | +@.str.3 = private unnamed_addr constant [12 x i8] c"str3_STRING\00", align 1 |
| 15 | +@llvm.used = appending global [1 x ptr] [ptr @keep_this], section "llvm.metadata" |
| 16 | +@llvm.compiler.used = appending global [1 x ptr] [ptr @keep_this2], section "llvm.metadata" |
| 17 | + |
| 18 | +declare signext i32 @callee(ptr noundef) |
| 19 | + |
| 20 | +define dso_local signext i32 @keep1() { |
| 21 | +entry: |
| 22 | + %call = tail call signext i32 @callee(ptr noundef nonnull @keep_this) |
| 23 | + ret i32 %call |
| 24 | +} |
| 25 | + |
| 26 | +define dso_local signext i32 @keep2() { |
| 27 | +entry: |
| 28 | + %call = tail call signext i32 @callee(ptr noundef nonnull @keep_this2) |
| 29 | + ret i32 %call |
| 30 | +} |
| 31 | + |
| 32 | +define dso_local signext i32 @str1() { |
| 33 | +entry: |
| 34 | + %call = tail call signext i32 @callee(ptr noundef nonnull @.str.1) |
| 35 | + ret i32 %call |
| 36 | +} |
| 37 | + |
| 38 | +define dso_local signext i32 @str2() { |
| 39 | +entry: |
| 40 | + %call = tail call signext i32 @callee(ptr noundef nonnull @.str.2) |
| 41 | + ret i32 %call |
| 42 | +} |
| 43 | + |
| 44 | +define dso_local signext i32 @str3() { |
| 45 | +entry: |
| 46 | + %call = tail call signext i32 @callee(ptr noundef nonnull @.str.3) |
| 47 | + ret i32 %call |
| 48 | +} |
| 49 | + |
| 50 | +; CHECK: .lglobl keep_this |
| 51 | +; CHECK: keep_this: |
| 52 | +; CHECK: .lglobl keep_this2 |
| 53 | +; CHECK: keep_this2: |
| 54 | +; CHECK: L..__ModuleStringPool: |
| 55 | +; CHECK: .string "str1_STRING" |
| 56 | +; CHECK: .string "str2_STRING" |
| 57 | +; CHECK: .string "str3_STRING" |
0 commit comments