33 lines · plain
1; Test to ensure that we can internalize values produced from two rounds2; of ThinLTO promotion, so they end up with two ".llvm.${hash}" suffixes.3; Only the second should be stripped when consulting the index to locate the4; summary.5;6; Note that this cannot happen currently via clang, but in other use cases such7; as the Rust compiler which does a first round of ThinLTO on library code,8; producing bitcode, and a second round on the final binary.9;10; In this case we assume a prior round of ThinLTO has promoted @foo, and11; subsequent optimization created an internal switch table expansion variable12; that is internal and contains the promoted name of the enclosing function.13; This variable will be promoted in the second round of ThinLTO if @foo is14; imported again.15 16; RUN: opt -module-summary -o %t.bc %s17; RUN: opt -module-summary -o %t-main.bc %S/Inputs/thinlto-internalize-doublepromoted.ll18; RUN: llvm-lto -thinlto-action=thinlink %t.bc %t-main.bc -o %t-index.bc19; RUN: llvm-lto -thinlto-action=internalize -exported-symbol=main -thinlto-index %t-index.bc %t.bc -o %t.internalize.bc20; RUN: llvm-dis %t.internalize.bc -o - | FileCheck %s21 22target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"23target triple = "x86_64-apple-macosx10.15.0"24 25; CHECK: @switch.table.foo.llvm.123.llvm.0 = hidden unnamed_addr constant26@switch.table.foo.llvm.123 = private unnamed_addr constant [10 x i8] c"\00\01\02\03\00\00\00\00\00\09", align 127 28; CHECK: define hidden void @foo.llvm.123()29define hidden void @foo.llvm.123() {30 store i8 1, ptr @switch.table.foo.llvm.123, align 831 ret void32}33