[llvm-branch-commits] [llvm] a084c03 - [TargetMachine] Don't imply dso_local on function declarations in Reloc::Static model for ELF/wasm

Fangrui Song via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Dec 5 14:59:28 PST 2020


Author: Fangrui Song
Date: 2020-12-05T14:54:37-08:00
New Revision: a084c0388e2a59b9556f2de0083333232da3f1d6

URL: https://github.com/llvm/llvm-project/commit/a084c0388e2a59b9556f2de0083333232da3f1d6
DIFF: https://github.com/llvm/llvm-project/commit/a084c0388e2a59b9556f2de0083333232da3f1d6.diff

LOG: [TargetMachine] Don't imply dso_local on function declarations in Reloc::Static model for ELF/wasm

clang/lib/CodeGen/CodeGenModule sets dso_local on applicable function declarations,
we don't need to duplicate the work in TargetMachine:shouldAssumeDSOLocal.
(Actually the long-term goal (started by r324535) is to drop TargetMachine::shouldAssumeDSOLocal.)

By not implying dso_local, we will respect dso_local/dso_preemptable specifiers
set by the frontend. This allows the proposed -fno-direct-access-external-data
option to work with -fno-pic and prevent a canonical PLT entry (SHN_UNDEF with non-zero st_value)
when taking the address of a function symbol.

This patch should be NFC in terms of the Clang emitted assembly because the case
we don't set dso_local is a case Clang sets dso_local. However, some tests don't
set dso_local on some function declarations and expose some differences. Most
tests have been fixed to be more robust in the previous commit.

Added: 
    

Modified: 
    llvm/lib/Target/TargetMachine.cpp
    llvm/lib/Target/X86/X86Subtarget.cpp
    llvm/test/CodeGen/AArch64/tiny_model.ll
    llvm/test/CodeGen/ARM/fast-isel-call.ll
    llvm/test/CodeGen/RISCV/mir-target-flags.ll
    llvm/test/CodeGen/X86/abi-isel.ll
    llvm/test/CodeGen/X86/absolute-cmp.ll
    llvm/test/CodeGen/X86/absolute-constant.ll
    llvm/test/CodeGen/X86/code-model-elf.ll
    llvm/test/CodeGen/X86/conditional-tailcall-pgso.ll
    llvm/test/CodeGen/X86/csr-split.ll
    llvm/test/CodeGen/X86/fp-stack-direct-ret.ll
    llvm/test/CodeGen/X86/jump_sign.ll
    llvm/test/CodeGen/X86/linux-preemption.ll
    llvm/test/CodeGen/X86/no-plt.ll
    llvm/test/CodeGen/X86/or-branch.ll
    llvm/test/CodeGen/X86/retpoline.ll
    llvm/test/CodeGen/X86/slow-incdec.ll
    llvm/test/CodeGen/X86/tailcall.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/TargetMachine.cpp b/llvm/lib/Target/TargetMachine.cpp
index dd41bc25ff3f..9770446470e7 100644
--- a/llvm/lib/Target/TargetMachine.cpp
+++ b/llvm/lib/Target/TargetMachine.cpp
@@ -101,10 +101,9 @@ bool TargetMachine::shouldAssumeDSOLocal(const Module &M,
   // dso_preemptable.  At this point in time, the various IR producers
   // have not been transitioned to always produce a dso_local when it
   // is possible to do so.
-  // In the case of ExternalSymbolSDNode, GV is null and there is nowhere to put
-  // dso_local. Returning false for those will produce worse code in some
-  // architectures. For example, on x86 the caller has to set ebx before calling
-  // a plt.
+  // In the case of ExternalSymbolSDNode, GV is null and we should just return
+  // false. However, COFF currently relies on this to be true
+  //
   // As a result we still have some logic in here to improve the quality of the
   // generated code.
   // FIXME: Add a module level metadata for whether intrinsics should be assumed
@@ -191,12 +190,8 @@ bool TargetMachine::shouldAssumeDSOLocal(const Module &M,
     // drop the if block entirely and respect dso_local/dso_preemptable
     // specifiers set by the frontend.
     if (RM == Reloc::Static) {
-      // We currently respect dso_local/dso_preemptable specifiers for
-      // variables.
-      if (F)
-        return true;
       // TODO Remove the special case for x86-32.
-      if (Arch == Triple::x86 && !GV->isThreadLocal())
+      if (Arch == Triple::x86 && !F && !GV->isThreadLocal())
         return true;
     }
   } else if (TT.isOSBinFormatELF()) {

diff  --git a/llvm/lib/Target/X86/X86Subtarget.cpp b/llvm/lib/Target/X86/X86Subtarget.cpp
index 684854725817..c95213c3539d 100644
--- a/llvm/lib/Target/X86/X86Subtarget.cpp
+++ b/llvm/lib/Target/X86/X86Subtarget.cpp
@@ -166,6 +166,10 @@ unsigned char X86Subtarget::classifyGlobalReference(const GlobalValue *GV,
     return X86II::MO_DARWIN_NONLAZY_PIC_BASE;
   }
 
+  // 32-bit ELF references GlobalAddress directly in static relocation model.
+  // We cannot use MO_GOT because EBX may not be set up.
+  if (TM.getRelocationModel() == Reloc::Static)
+    return X86II::MO_NO_FLAG;
   return X86II::MO_GOT;
 }
 

diff  --git a/llvm/test/CodeGen/AArch64/tiny_model.ll b/llvm/test/CodeGen/AArch64/tiny_model.ll
index c66e09df3c29..8f56ed1e37f7 100644
--- a/llvm/test/CodeGen/AArch64/tiny_model.ll
+++ b/llvm/test/CodeGen/AArch64/tiny_model.ll
@@ -370,12 +370,12 @@ declare void @func(...)
 define i8* @externfuncaddr() {
 ; CHECK-LABEL: externfuncaddr:
 ; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    adr x0, func
+; CHECK-NEXT:    ldr x0, :got:func
 ; CHECK-NEXT:    ret
 ;
 ; CHECK-GLOBISEL-LABEL: externfuncaddr:
 ; CHECK-GLOBISEL:       // %bb.0: // %entry
-; CHECK-GLOBISEL-NEXT:    adr x0, func
+; CHECK-GLOBISEL-NEXT:    ldr x0, :got:func
 ; CHECK-GLOBISEL-NEXT:    ret
 ;
 ; CHECK-PIC-LABEL: externfuncaddr:

diff  --git a/llvm/test/CodeGen/ARM/fast-isel-call.ll b/llvm/test/CodeGen/ARM/fast-isel-call.ll
index 293c268c5359..991db29efe78 100644
--- a/llvm/test/CodeGen/ARM/fast-isel-call.ll
+++ b/llvm/test/CodeGen/ARM/fast-isel-call.ll
@@ -109,8 +109,9 @@ entry:
 ; ARM-LONG-MACHO: {{(movt [[R1]], :upper16:L_bar\$non_lazy_ptr)?}}
 ; ARM-LONG-MACHO: ldr [[R:r[0-9]+]], {{\[}}[[R1]]]
 
-; ARM-LONG-ELF: movw [[R:l?r[0-9]*]], :lower16:bar
-; ARM-LONG-ELF: {{(movt [[R]], :upper16:L_bar\$non_lazy_ptr)?}}
+; ARM-LONG-ELF: movw [[R1:r[0-9]*]], :lower16:bar
+; ARM-LONG-ELF: movt [[R1]], :upper16:bar
+; ARM-LONG-ELF: ldr [[R:r[0-9]+]], {{\[}}[[R1]]]
 
 ; ARM-LONG: blx [[R]]
 ; THUMB: @t10

diff  --git a/llvm/test/CodeGen/RISCV/mir-target-flags.ll b/llvm/test/CodeGen/RISCV/mir-target-flags.ll
index f41fb77dbb00..4dc45e2159fb 100644
--- a/llvm/test/CodeGen/RISCV/mir-target-flags.ll
+++ b/llvm/test/CodeGen/RISCV/mir-target-flags.ll
@@ -35,7 +35,7 @@ define i32 @caller(i32 %a) nounwind {
 ; RV32-SMALL:      target-flags(riscv-tprel-hi) @t_le
 ; RV32-SMALL-NEXT: target-flags(riscv-tprel-add) @t_le
 ; RV32-SMALL-NEXT: target-flags(riscv-tprel-lo) @t_le
-; RV32-SMALL:      target-flags(riscv-call) @callee
+; RV32-SMALL:      target-flags(riscv-plt) @callee
 ;
 ; RV32-MED-LABEL: name: caller
 ; RV32-MED:      target-flags(riscv-got-hi) @g_e

diff  --git a/llvm/test/CodeGen/X86/abi-isel.ll b/llvm/test/CodeGen/X86/abi-isel.ll
index a416a5abb978..102120aa66bd 100644
--- a/llvm/test/CodeGen/X86/abi-isel.ll
+++ b/llvm/test/CodeGen/X86/abi-isel.ll
@@ -10676,26 +10676,26 @@ define void @lcallee() nounwind {
 ; LINUX-64-STATIC-LABEL: lcallee:
 ; LINUX-64-STATIC:       # %bb.0: # %entry
 ; LINUX-64-STATIC-NEXT:    pushq %rax
-; LINUX-64-STATIC-NEXT:    callq x
-; LINUX-64-STATIC-NEXT:    callq x
-; LINUX-64-STATIC-NEXT:    callq x
-; LINUX-64-STATIC-NEXT:    callq x
-; LINUX-64-STATIC-NEXT:    callq x
-; LINUX-64-STATIC-NEXT:    callq x
-; LINUX-64-STATIC-NEXT:    callq x
+; LINUX-64-STATIC-NEXT:    callq x at PLT
+; LINUX-64-STATIC-NEXT:    callq x at PLT
+; LINUX-64-STATIC-NEXT:    callq x at PLT
+; LINUX-64-STATIC-NEXT:    callq x at PLT
+; LINUX-64-STATIC-NEXT:    callq x at PLT
+; LINUX-64-STATIC-NEXT:    callq x at PLT
+; LINUX-64-STATIC-NEXT:    callq x at PLT
 ; LINUX-64-STATIC-NEXT:    popq %rax
 ; LINUX-64-STATIC-NEXT:    retq
 ;
 ; LINUX-32-STATIC-LABEL: lcallee:
 ; LINUX-32-STATIC:       # %bb.0: # %entry
 ; LINUX-32-STATIC-NEXT:    subl $12, %esp
-; LINUX-32-STATIC-NEXT:    calll x
-; LINUX-32-STATIC-NEXT:    calll x
-; LINUX-32-STATIC-NEXT:    calll x
-; LINUX-32-STATIC-NEXT:    calll x
-; LINUX-32-STATIC-NEXT:    calll x
-; LINUX-32-STATIC-NEXT:    calll x
-; LINUX-32-STATIC-NEXT:    calll x
+; LINUX-32-STATIC-NEXT:    calll x at PLT
+; LINUX-32-STATIC-NEXT:    calll x at PLT
+; LINUX-32-STATIC-NEXT:    calll x at PLT
+; LINUX-32-STATIC-NEXT:    calll x at PLT
+; LINUX-32-STATIC-NEXT:    calll x at PLT
+; LINUX-32-STATIC-NEXT:    calll x at PLT
+; LINUX-32-STATIC-NEXT:    calll x at PLT
 ; LINUX-32-STATIC-NEXT:    addl $12, %esp
 ; LINUX-32-STATIC-NEXT:    retl
 ;
@@ -10827,26 +10827,26 @@ define internal void @dcallee() nounwind {
 ; LINUX-64-STATIC-LABEL: dcallee:
 ; LINUX-64-STATIC:       # %bb.0: # %entry
 ; LINUX-64-STATIC-NEXT:    pushq %rax
-; LINUX-64-STATIC-NEXT:    callq y
-; LINUX-64-STATIC-NEXT:    callq y
-; LINUX-64-STATIC-NEXT:    callq y
-; LINUX-64-STATIC-NEXT:    callq y
-; LINUX-64-STATIC-NEXT:    callq y
-; LINUX-64-STATIC-NEXT:    callq y
-; LINUX-64-STATIC-NEXT:    callq y
+; LINUX-64-STATIC-NEXT:    callq y at PLT
+; LINUX-64-STATIC-NEXT:    callq y at PLT
+; LINUX-64-STATIC-NEXT:    callq y at PLT
+; LINUX-64-STATIC-NEXT:    callq y at PLT
+; LINUX-64-STATIC-NEXT:    callq y at PLT
+; LINUX-64-STATIC-NEXT:    callq y at PLT
+; LINUX-64-STATIC-NEXT:    callq y at PLT
 ; LINUX-64-STATIC-NEXT:    popq %rax
 ; LINUX-64-STATIC-NEXT:    retq
 ;
 ; LINUX-32-STATIC-LABEL: dcallee:
 ; LINUX-32-STATIC:       # %bb.0: # %entry
 ; LINUX-32-STATIC-NEXT:    subl $12, %esp
-; LINUX-32-STATIC-NEXT:    calll y
-; LINUX-32-STATIC-NEXT:    calll y
-; LINUX-32-STATIC-NEXT:    calll y
-; LINUX-32-STATIC-NEXT:    calll y
-; LINUX-32-STATIC-NEXT:    calll y
-; LINUX-32-STATIC-NEXT:    calll y
-; LINUX-32-STATIC-NEXT:    calll y
+; LINUX-32-STATIC-NEXT:    calll y at PLT
+; LINUX-32-STATIC-NEXT:    calll y at PLT
+; LINUX-32-STATIC-NEXT:    calll y at PLT
+; LINUX-32-STATIC-NEXT:    calll y at PLT
+; LINUX-32-STATIC-NEXT:    calll y at PLT
+; LINUX-32-STATIC-NEXT:    calll y at PLT
+; LINUX-32-STATIC-NEXT:    calll y at PLT
 ; LINUX-32-STATIC-NEXT:    addl $12, %esp
 ; LINUX-32-STATIC-NEXT:    retl
 ;
@@ -10977,7 +10977,7 @@ declare void @y()
 define void ()* @address() nounwind {
 ; LINUX-64-STATIC-LABEL: address:
 ; LINUX-64-STATIC:       # %bb.0: # %entry
-; LINUX-64-STATIC-NEXT:    movl $callee, %eax
+; LINUX-64-STATIC-NEXT:    movq callee@{{.*}}(%rip), %rax
 ; LINUX-64-STATIC-NEXT:    retq
 ;
 ; LINUX-32-STATIC-LABEL: address:
@@ -11169,16 +11169,16 @@ define void @caller() nounwind {
 ; LINUX-64-STATIC-LABEL: caller:
 ; LINUX-64-STATIC:       # %bb.0: # %entry
 ; LINUX-64-STATIC-NEXT:    pushq %rax
-; LINUX-64-STATIC-NEXT:    callq callee
-; LINUX-64-STATIC-NEXT:    callq callee
+; LINUX-64-STATIC-NEXT:    callq callee at PLT
+; LINUX-64-STATIC-NEXT:    callq callee at PLT
 ; LINUX-64-STATIC-NEXT:    popq %rax
 ; LINUX-64-STATIC-NEXT:    retq
 ;
 ; LINUX-32-STATIC-LABEL: caller:
 ; LINUX-32-STATIC:       # %bb.0: # %entry
 ; LINUX-32-STATIC-NEXT:    subl $12, %esp
-; LINUX-32-STATIC-NEXT:    calll callee
-; LINUX-32-STATIC-NEXT:    calll callee
+; LINUX-32-STATIC-NEXT:    calll callee at PLT
+; LINUX-32-STATIC-NEXT:    calll callee at PLT
 ; LINUX-32-STATIC-NEXT:    addl $12, %esp
 ; LINUX-32-STATIC-NEXT:    retl
 ;
@@ -11451,14 +11451,14 @@ define void @tailcaller() nounwind {
 ; LINUX-64-STATIC-LABEL: tailcaller:
 ; LINUX-64-STATIC:       # %bb.0: # %entry
 ; LINUX-64-STATIC-NEXT:    pushq %rax
-; LINUX-64-STATIC-NEXT:    callq callee
+; LINUX-64-STATIC-NEXT:    callq callee at PLT
 ; LINUX-64-STATIC-NEXT:    popq %rax
 ; LINUX-64-STATIC-NEXT:    retq
 ;
 ; LINUX-32-STATIC-LABEL: tailcaller:
 ; LINUX-32-STATIC:       # %bb.0: # %entry
 ; LINUX-32-STATIC-NEXT:    subl $12, %esp
-; LINUX-32-STATIC-NEXT:    calll callee
+; LINUX-32-STATIC-NEXT:    calll callee at PLT
 ; LINUX-32-STATIC-NEXT:    addl $12, %esp
 ; LINUX-32-STATIC-NEXT:    retl
 ;

diff  --git a/llvm/test/CodeGen/X86/absolute-cmp.ll b/llvm/test/CodeGen/X86/absolute-cmp.ll
index 4d8634d439bd..3f4643ac1a8a 100644
--- a/llvm/test/CodeGen/X86/absolute-cmp.ll
+++ b/llvm/test/CodeGen/X86/absolute-cmp.ll
@@ -20,8 +20,8 @@ define void @foo8(i64 %val) {
 ; NOPIC-NEXT:  # %bb.1: # %t
 ; NOPIC-NEXT:    pushq %rax # encoding: [0x50]
 ; NOPIC-NEXT:    .cfi_def_cfa_offset 16
-; NOPIC-NEXT:    callq f # encoding: [0xe8,A,A,A,A]
-; NOPIC-NEXT:    # fixup A - offset: 1, value: f-4, kind: reloc_branch_4byte_pcrel
+; NOPIC-NEXT:    callq f at PLT # encoding: [0xe8,A,A,A,A]
+; NOPIC-NEXT:    # fixup A - offset: 1, value: f at PLT-4, kind: FK_PCRel_4
 ; NOPIC-NEXT:    popq %rax # encoding: [0x58]
 ; NOPIC-NEXT:    .cfi_def_cfa_offset 8
 ; NOPIC-NEXT:  .LBB0_2: # %f
@@ -63,8 +63,8 @@ define void @foo32(i64 %val) {
 ; NOPIC-NEXT:  # %bb.1: # %t
 ; NOPIC-NEXT:    pushq %rax # encoding: [0x50]
 ; NOPIC-NEXT:    .cfi_def_cfa_offset 16
-; NOPIC-NEXT:    callq f # encoding: [0xe8,A,A,A,A]
-; NOPIC-NEXT:    # fixup A - offset: 1, value: f-4, kind: reloc_branch_4byte_pcrel
+; NOPIC-NEXT:    callq f at PLT # encoding: [0xe8,A,A,A,A]
+; NOPIC-NEXT:    # fixup A - offset: 1, value: f at PLT-4, kind: FK_PCRel_4
 ; NOPIC-NEXT:    popq %rax # encoding: [0x58]
 ; NOPIC-NEXT:    .cfi_def_cfa_offset 8
 ; NOPIC-NEXT:  .LBB1_2: # %f

diff  --git a/llvm/test/CodeGen/X86/absolute-constant.ll b/llvm/test/CodeGen/X86/absolute-constant.ll
index dba0ca62914d..45797be142f5 100644
--- a/llvm/test/CodeGen/X86/absolute-constant.ll
+++ b/llvm/test/CodeGen/X86/absolute-constant.ll
@@ -14,7 +14,7 @@ define void @bar(i8* %x) {
 ; CHECK-NEXT:    je .LBB0_1
 ; CHECK-NEXT:  # %bb.2: # %if.then
 ; CHECK-NEXT:    xorl %eax, %eax
-; CHECK-NEXT:    jmp xf # TAILCALL
+; CHECK-NEXT:    jmp xf at PLT # TAILCALL
 ; CHECK-NEXT:  .LBB0_1: # %if.end
 ; CHECK-NEXT:    retq
 ;

diff  --git a/llvm/test/CodeGen/X86/code-model-elf.ll b/llvm/test/CodeGen/X86/code-model-elf.ll
index 2286348e794e..ab25b64960a7 100644
--- a/llvm/test/CodeGen/X86/code-model-elf.ll
+++ b/llvm/test/CodeGen/X86/code-model-elf.ll
@@ -341,12 +341,12 @@ define dso_local void ()* @lea_global_fn() #0 {
 define dso_local void ()* @lea_extern_fn() #0 {
 ; SMALL-STATIC-LABEL: lea_extern_fn:
 ; SMALL-STATIC:       # %bb.0:
-; SMALL-STATIC-NEXT:    movl $extern_fn, %eax
+; SMALL-STATIC-NEXT:    movq extern_fn@{{.*}}(%rip), %rax
 ; SMALL-STATIC-NEXT:    retq
 ;
 ; MEDIUM-STATIC-LABEL: lea_extern_fn:
 ; MEDIUM-STATIC:       # %bb.0:
-; MEDIUM-STATIC-NEXT:    movabsq $extern_fn, %rax
+; MEDIUM-STATIC-NEXT:    movq extern_fn@{{.*}}(%rip), %rax
 ; MEDIUM-STATIC-NEXT:    retq
 ;
 ; LARGE-STATIC-LABEL: lea_extern_fn:

diff  --git a/llvm/test/CodeGen/X86/conditional-tailcall-pgso.ll b/llvm/test/CodeGen/X86/conditional-tailcall-pgso.ll
index a473dd5e9d84..2751fe441791 100644
--- a/llvm/test/CodeGen/X86/conditional-tailcall-pgso.ll
+++ b/llvm/test/CodeGen/X86/conditional-tailcall-pgso.ll
@@ -11,24 +11,24 @@ define void @f(i32 %x, i32 %y) !prof !14 {
 ; CHECK32:       # %bb.0: # %entry
 ; CHECK32-NEXT:    movl {{[0-9]+}}(%esp), %eax # encoding: [0x8b,0x44,0x24,0x04]
 ; CHECK32-NEXT:    cmpl {{[0-9]+}}(%esp), %eax # encoding: [0x3b,0x44,0x24,0x08]
-; CHECK32-NEXT:    jne bar # TAILCALL
+; CHECK32-NEXT:    jne bar at PLT # TAILCALL
 ; CHECK32-NEXT:    # encoding: [0x75,A]
-; CHECK32-NEXT:    # fixup A - offset: 1, value: bar-1, kind: FK_PCRel_1
+; CHECK32-NEXT:    # fixup A - offset: 1, value: bar at PLT-1, kind: FK_PCRel_1
 ; CHECK32-NEXT:  # %bb.1: # %bb1
-; CHECK32-NEXT:    jmp foo # TAILCALL
+; CHECK32-NEXT:    jmp foo at PLT # TAILCALL
 ; CHECK32-NEXT:    # encoding: [0xeb,A]
-; CHECK32-NEXT:    # fixup A - offset: 1, value: foo-1, kind: FK_PCRel_1
+; CHECK32-NEXT:    # fixup A - offset: 1, value: foo at PLT-1, kind: FK_PCRel_1
 ;
 ; CHECK64-LABEL: f:
 ; CHECK64:       # %bb.0: # %entry
 ; CHECK64-NEXT:    cmpl %esi, %edi # encoding: [0x39,0xf7]
-; CHECK64-NEXT:    jne bar # TAILCALL
+; CHECK64-NEXT:    jne bar at PLT # TAILCALL
 ; CHECK64-NEXT:    # encoding: [0x75,A]
-; CHECK64-NEXT:    # fixup A - offset: 1, value: bar-1, kind: FK_PCRel_1
+; CHECK64-NEXT:    # fixup A - offset: 1, value: bar at PLT-1, kind: FK_PCRel_1
 ; CHECK64-NEXT:  # %bb.1: # %bb1
-; CHECK64-NEXT:    jmp foo # TAILCALL
+; CHECK64-NEXT:    jmp foo at PLT # TAILCALL
 ; CHECK64-NEXT:    # encoding: [0xeb,A]
-; CHECK64-NEXT:    # fixup A - offset: 1, value: foo-1, kind: FK_PCRel_1
+; CHECK64-NEXT:    # fixup A - offset: 1, value: foo at PLT-1, kind: FK_PCRel_1
 ;
 ; WIN64-LABEL: f:
 ; WIN64:       # %bb.0: # %entry
@@ -68,16 +68,16 @@ define void @f_non_leaf(i32 %x, i32 %y) !prof !14 {
 ; CHECK32-NEXT:  # %bb.1: # %bb1
 ; CHECK32-NEXT:    popl %ebx # encoding: [0x5b]
 ; CHECK32-NEXT:    .cfi_def_cfa_offset 4
-; CHECK32-NEXT:    jmp foo # TAILCALL
+; CHECK32-NEXT:    jmp foo at PLT # TAILCALL
 ; CHECK32-NEXT:    # encoding: [0xeb,A]
-; CHECK32-NEXT:    # fixup A - offset: 1, value: foo-1, kind: FK_PCRel_1
+; CHECK32-NEXT:    # fixup A - offset: 1, value: foo at PLT-1, kind: FK_PCRel_1
 ; CHECK32-NEXT:  .LBB1_2: # %bb2
 ; CHECK32-NEXT:    .cfi_def_cfa_offset 8
 ; CHECK32-NEXT:    popl %ebx # encoding: [0x5b]
 ; CHECK32-NEXT:    .cfi_def_cfa_offset 4
-; CHECK32-NEXT:    jmp bar # TAILCALL
+; CHECK32-NEXT:    jmp bar at PLT # TAILCALL
 ; CHECK32-NEXT:    # encoding: [0xeb,A]
-; CHECK32-NEXT:    # fixup A - offset: 1, value: bar-1, kind: FK_PCRel_1
+; CHECK32-NEXT:    # fixup A - offset: 1, value: bar at PLT-1, kind: FK_PCRel_1
 ;
 ; CHECK64-LABEL: f_non_leaf:
 ; CHECK64:       # %bb.0: # %entry
@@ -92,16 +92,16 @@ define void @f_non_leaf(i32 %x, i32 %y) !prof !14 {
 ; CHECK64-NEXT:  # %bb.1: # %bb1
 ; CHECK64-NEXT:    popq %rbx # encoding: [0x5b]
 ; CHECK64-NEXT:    .cfi_def_cfa_offset 8
-; CHECK64-NEXT:    jmp foo # TAILCALL
+; CHECK64-NEXT:    jmp foo at PLT # TAILCALL
 ; CHECK64-NEXT:    # encoding: [0xeb,A]
-; CHECK64-NEXT:    # fixup A - offset: 1, value: foo-1, kind: FK_PCRel_1
+; CHECK64-NEXT:    # fixup A - offset: 1, value: foo at PLT-1, kind: FK_PCRel_1
 ; CHECK64-NEXT:  .LBB1_2: # %bb2
 ; CHECK64-NEXT:    .cfi_def_cfa_offset 16
 ; CHECK64-NEXT:    popq %rbx # encoding: [0x5b]
 ; CHECK64-NEXT:    .cfi_def_cfa_offset 8
-; CHECK64-NEXT:    jmp bar # TAILCALL
+; CHECK64-NEXT:    jmp bar at PLT # TAILCALL
 ; CHECK64-NEXT:    # encoding: [0xeb,A]
-; CHECK64-NEXT:    # fixup A - offset: 1, value: bar-1, kind: FK_PCRel_1
+; CHECK64-NEXT:    # fixup A - offset: 1, value: bar at PLT-1, kind: FK_PCRel_1
 ;
 ; WIN64-LABEL: f_non_leaf:
 ; WIN64:       # %bb.0: # %entry
@@ -152,9 +152,9 @@ define x86_thiscallcc zeroext i1 @BlockPlacementTest(i8* %this, i32 %x) !prof !1
 ; CHECK32-NEXT:  # %bb.1: # %land.rhs
 ; CHECK32-NEXT:    movb $1, %al # encoding: [0xb0,0x01]
 ; CHECK32-NEXT:    testb $44, %dl # encoding: [0xf6,0xc2,0x2c]
-; CHECK32-NEXT:    je baz # TAILCALL
+; CHECK32-NEXT:    je baz at PLT # TAILCALL
 ; CHECK32-NEXT:    # encoding: [0x74,A]
-; CHECK32-NEXT:    # fixup A - offset: 1, value: baz-1, kind: FK_PCRel_1
+; CHECK32-NEXT:    # fixup A - offset: 1, value: baz at PLT-1, kind: FK_PCRel_1
 ; CHECK32-NEXT:  .LBB2_2: # %land.end
 ; CHECK32-NEXT:    # kill: def $al killed $al killed $eax
 ; CHECK32-NEXT:    retl $4 # encoding: [0xc2,0x04,0x00]
@@ -171,9 +171,9 @@ define x86_thiscallcc zeroext i1 @BlockPlacementTest(i8* %this, i32 %x) !prof !1
 ; CHECK64-NEXT:  # %bb.1: # %land.rhs
 ; CHECK64-NEXT:    movb $1, %al # encoding: [0xb0,0x01]
 ; CHECK64-NEXT:    testb $44, %sil # encoding: [0x40,0xf6,0xc6,0x2c]
-; CHECK64-NEXT:    je baz # TAILCALL
+; CHECK64-NEXT:    je baz at PLT # TAILCALL
 ; CHECK64-NEXT:    # encoding: [0x74,A]
-; CHECK64-NEXT:    # fixup A - offset: 1, value: baz-1, kind: FK_PCRel_1
+; CHECK64-NEXT:    # fixup A - offset: 1, value: baz at PLT-1, kind: FK_PCRel_1
 ; CHECK64-NEXT:  .LBB2_2: # %land.end
 ; CHECK64-NEXT:    # kill: def $al killed $al killed $eax
 ; CHECK64-NEXT:    retq # encoding: [0xc3]

diff  --git a/llvm/test/CodeGen/X86/csr-split.ll b/llvm/test/CodeGen/X86/csr-split.ll
index 9bd480338aa2..ebea77e955d8 100644
--- a/llvm/test/CodeGen/X86/csr-split.ll
+++ b/llvm/test/CodeGen/X86/csr-split.ll
@@ -22,11 +22,11 @@ define dso_local signext i32 @test1(i32* %b) local_unnamed_addr  {
 ; CHECK-NEXT:  .LBB0_2: # %if.then
 ; CHECK-NEXT:    .cfi_def_cfa_offset 16
 ; CHECK-NEXT:    movq %rdi, %rbx
-; CHECK-NEXT:    callq callVoid
+; CHECK-NEXT:    callq callVoid at PLT
 ; CHECK-NEXT:    movq %rbx, %rdi
 ; CHECK-NEXT:    popq %rbx
 ; CHECK-NEXT:    .cfi_def_cfa_offset 8
-; CHECK-NEXT:    jmp callNonVoid # TAILCALL
+; CHECK-NEXT:    jmp callNonVoid at PLT # TAILCALL
 ;
 ; CHECK-32BIT-LABEL: test1:
 ; CHECK-32BIT:       # %bb.0: # %entry
@@ -41,10 +41,10 @@ define dso_local signext i32 @test1(i32* %b) local_unnamed_addr  {
 ; CHECK-32BIT-NEXT:    retl
 ; CHECK-32BIT-NEXT:  .LBB0_2: # %if.then
 ; CHECK-32BIT-NEXT:    .cfi_def_cfa_offset 16
-; CHECK-32BIT-NEXT:    calll callVoid
+; CHECK-32BIT-NEXT:    calll callVoid at PLT
 ; CHECK-32BIT-NEXT:    addl $12, %esp
 ; CHECK-32BIT-NEXT:    .cfi_def_cfa_offset 4
-; CHECK-32BIT-NEXT:    jmp callNonVoid # TAILCALL
+; CHECK-32BIT-NEXT:    jmp callNonVoid at PLT # TAILCALL
 entry:
   %0 = load i32, i32* @a, align 4, !tbaa !2
   %conv = sext i32 %0 to i64
@@ -86,11 +86,11 @@ define dso_local signext i32 @test2(i32* %p1) local_unnamed_addr  {
 ; CHECK-NEXT:    retq
 ; CHECK-NEXT:  .LBB1_3: # %if.then2
 ; CHECK-NEXT:    .cfi_def_cfa_offset 16
-; CHECK-NEXT:    callq callVoid
+; CHECK-NEXT:    callq callVoid at PLT
 ; CHECK-NEXT:    movq %rbx, %rdi
 ; CHECK-NEXT:    popq %rbx
 ; CHECK-NEXT:    .cfi_def_cfa_offset 8
-; CHECK-NEXT:    jmp callNonVoid # TAILCALL
+; CHECK-NEXT:    jmp callNonVoid at PLT # TAILCALL
 ;
 ; CHECK-32BIT-LABEL: test2:
 ; CHECK-32BIT:       # %bb.0: # %entry
@@ -109,10 +109,10 @@ define dso_local signext i32 @test2(i32* %p1) local_unnamed_addr  {
 ; CHECK-32BIT-NEXT:    retl
 ; CHECK-32BIT-NEXT:  .LBB1_3: # %if.then2
 ; CHECK-32BIT-NEXT:    .cfi_def_cfa_offset 16
-; CHECK-32BIT-NEXT:    calll callVoid
+; CHECK-32BIT-NEXT:    calll callVoid at PLT
 ; CHECK-32BIT-NEXT:    addl $12, %esp
 ; CHECK-32BIT-NEXT:    .cfi_def_cfa_offset 4
-; CHECK-32BIT-NEXT:    jmp callNonVoid # TAILCALL
+; CHECK-32BIT-NEXT:    jmp callNonVoid at PLT # TAILCALL
 entry:
   %tobool = icmp eq i32* %p1, null
   br i1 %tobool, label %return, label %if.end
@@ -153,7 +153,7 @@ define dso_local i8* @test3(i8** nocapture %p1, i8 zeroext %p2) local_unnamed_ad
 ; CHECK-NEXT:    movq %rdi, %r14
 ; CHECK-NEXT:    movzbl %sil, %esi
 ; CHECK-NEXT:    movq %rbx, %rdi
-; CHECK-NEXT:    callq bar
+; CHECK-NEXT:    callq bar at PLT
 ; CHECK-NEXT:    movq %rax, (%r14)
 ; CHECK-NEXT:  .LBB2_2: # %land.end
 ; CHECK-NEXT:    movq %rbx, %rax
@@ -187,7 +187,7 @@ define dso_local i8* @test3(i8** nocapture %p1, i8 zeroext %p2) local_unnamed_ad
 ; CHECK-32BIT-NEXT:    .cfi_adjust_cfa_offset 4
 ; CHECK-32BIT-NEXT:    pushl %esi
 ; CHECK-32BIT-NEXT:    .cfi_adjust_cfa_offset 4
-; CHECK-32BIT-NEXT:    calll bar
+; CHECK-32BIT-NEXT:    calll bar at PLT
 ; CHECK-32BIT-NEXT:    addl $16, %esp
 ; CHECK-32BIT-NEXT:    .cfi_adjust_cfa_offset -16
 ; CHECK-32BIT-NEXT:    movl %eax, (%edi)

diff  --git a/llvm/test/CodeGen/X86/fp-stack-direct-ret.ll b/llvm/test/CodeGen/X86/fp-stack-direct-ret.ll
index b9de7ae4f622..f1bb5adf8e16 100644
--- a/llvm/test/CodeGen/X86/fp-stack-direct-ret.ll
+++ b/llvm/test/CodeGen/X86/fp-stack-direct-ret.ll
@@ -7,7 +7,7 @@ declare double @foo()
 define double @bar() {
 ; ALL-LABEL: bar:
 ; ALL:       # %bb.0: # %entry
-; ALL-NEXT:    jmp foo # TAILCALL
+; ALL-NEXT:    jmp foo at PLT # TAILCALL
 entry:
 	%tmp5 = tail call double @foo()
 	ret double %tmp5

diff  --git a/llvm/test/CodeGen/X86/jump_sign.ll b/llvm/test/CodeGen/X86/jump_sign.ll
index 78a322004380..b2cfa72235fc 100644
--- a/llvm/test/CodeGen/X86/jump_sign.ll
+++ b/llvm/test/CodeGen/X86/jump_sign.ll
@@ -8,9 +8,9 @@ define i32 @func_f(i32 %X) {
 ; CHECK-NEXT:    incl %eax
 ; CHECK-NEXT:    jns .LBB0_2
 ; CHECK-NEXT:  # %bb.1: # %cond_true
-; CHECK-NEXT:    calll bar
+; CHECK-NEXT:    calll bar at PLT
 ; CHECK-NEXT:  .LBB0_2: # %cond_next
-; CHECK-NEXT:    jmp baz # TAILCALL
+; CHECK-NEXT:    jmp baz at PLT # TAILCALL
 entry:
 	%tmp1 = add i32 %X, 1
 	%tmp = icmp slt i32 %tmp1, 0

diff  --git a/llvm/test/CodeGen/X86/linux-preemption.ll b/llvm/test/CodeGen/X86/linux-preemption.ll
index f16327ce89fe..4739e6cec011 100644
--- a/llvm/test/CodeGen/X86/linux-preemption.ll
+++ b/llvm/test/CodeGen/X86/linux-preemption.ll
@@ -190,7 +190,7 @@ define void()* @get_external_default_function() {
   ret void()* @external_default_function
 }
 ; CHECK: movq external_default_function at GOTPCREL(%rip), %rax
-; STATIC: movl $external_default_function, %eax
+; STATIC: movq external_default_function at GOTPCREL(%rip), %rax
 ; CHECK32: movl external_default_function at GOT(%eax), %eax
 
 define dso_local void @strong_local_function() {
@@ -249,7 +249,7 @@ define void()* @get_external_preemptable_function() {
   ret void()* @external_preemptable_function
 }
 ; CHECK: movq external_preemptable_function at GOTPCREL(%rip), %rax
-; STATIC: movl $external_preemptable_function, %eax
+; STATIC: movq external_preemptable_function at GOTPCREL(%rip), %rax
 ; CHECK32: movl external_preemptable_function at GOT(%eax), %eax
 
 !llvm.module.flags = !{!0}

diff  --git a/llvm/test/CodeGen/X86/no-plt.ll b/llvm/test/CodeGen/X86/no-plt.ll
index 1094c0623d60..563497ea6255 100644
--- a/llvm/test/CodeGen/X86/no-plt.ll
+++ b/llvm/test/CodeGen/X86/no-plt.ll
@@ -24,7 +24,7 @@ define void @memcpy_call(i8* nocapture %a, i8* nocapture readonly %b, i64 %n) {
 define i32 @main() {
 ; X64:    callq *foo at GOTPCREL(%rip)
 ; PIC:    callq bar at PLT
-; STATIC: callq bar{{$}}
+; STATIC: callq bar at PLT
 ; X64:    callq baz
 
   %retval = alloca i32, align 4

diff  --git a/llvm/test/CodeGen/X86/or-branch.ll b/llvm/test/CodeGen/X86/or-branch.ll
index 8341e3789900..1f71b97d2bef 100644
--- a/llvm/test/CodeGen/X86/or-branch.ll
+++ b/llvm/test/CodeGen/X86/or-branch.ll
@@ -13,7 +13,7 @@ define void @foo(i32 %X, i32 %Y, i32 %Z) nounwind {
 ; JUMP2-NEXT:  # %bb.2: # %UnifiedReturnBlock
 ; JUMP2-NEXT:    retl
 ; JUMP2-NEXT:  .LBB0_3: # %cond_true
-; JUMP2-NEXT:    jmp bar # TAILCALL
+; JUMP2-NEXT:    jmp bar at PLT # TAILCALL
 ;
 ; JUMP1-LABEL: foo:
 ; JUMP1:       # %bb.0: # %entry
@@ -24,7 +24,7 @@ define void @foo(i32 %X, i32 %Y, i32 %Z) nounwind {
 ; JUMP1-NEXT:    testb %al, %cl
 ; JUMP1-NEXT:    jne .LBB0_1
 ; JUMP1-NEXT:  # %bb.2: # %cond_true
-; JUMP1-NEXT:    jmp bar # TAILCALL
+; JUMP1-NEXT:    jmp bar at PLT # TAILCALL
 ; JUMP1-NEXT:  .LBB0_1: # %UnifiedReturnBlock
 ; JUMP1-NEXT:    retl
 entry:
@@ -54,7 +54,7 @@ define void @unpredictable(i32 %X, i32 %Y, i32 %Z) nounwind {
 ; JUMP2-NEXT:    testb %al, %cl
 ; JUMP2-NEXT:    jne .LBB1_1
 ; JUMP2-NEXT:  # %bb.2: # %cond_true
-; JUMP2-NEXT:    jmp bar # TAILCALL
+; JUMP2-NEXT:    jmp bar at PLT # TAILCALL
 ; JUMP2-NEXT:  .LBB1_1: # %UnifiedReturnBlock
 ; JUMP2-NEXT:    retl
 ;
@@ -67,7 +67,7 @@ define void @unpredictable(i32 %X, i32 %Y, i32 %Z) nounwind {
 ; JUMP1-NEXT:    testb %al, %cl
 ; JUMP1-NEXT:    jne .LBB1_1
 ; JUMP1-NEXT:  # %bb.2: # %cond_true
-; JUMP1-NEXT:    jmp bar # TAILCALL
+; JUMP1-NEXT:    jmp bar at PLT # TAILCALL
 ; JUMP1-NEXT:  .LBB1_1: # %UnifiedReturnBlock
 ; JUMP1-NEXT:    retl
 entry:

diff  --git a/llvm/test/CodeGen/X86/retpoline.ll b/llvm/test/CodeGen/X86/retpoline.ll
index 155c1540ea88..45af5fe230ef 100644
--- a/llvm/test/CodeGen/X86/retpoline.ll
+++ b/llvm/test/CodeGen/X86/retpoline.ll
@@ -147,13 +147,13 @@ define void @direct_tail() #0 {
 }
 
 ; X64-LABEL: direct_tail:
-; X64:       jmp direct_callee # TAILCALL
+; X64:       jmp direct_callee at PLT # TAILCALL
 ; X64FAST-LABEL: direct_tail:
-; X64FAST:   jmp direct_callee # TAILCALL
+; X64FAST:   jmp direct_callee at PLT # TAILCALL
 ; X86-LABEL: direct_tail:
-; X86:       jmp direct_callee # TAILCALL
+; X86:       jmp direct_callee at PLT # TAILCALL
 ; X86FAST-LABEL: direct_tail:
-; X86FAST:   jmp direct_callee # TAILCALL
+; X86FAST:   jmp direct_callee at PLT # TAILCALL
 
 
 declare void @nonlazybind_callee() #2

diff  --git a/llvm/test/CodeGen/X86/slow-incdec.ll b/llvm/test/CodeGen/X86/slow-incdec.ll
index 6f4ad98a59a9..e9f5fe650596 100644
--- a/llvm/test/CodeGen/X86/slow-incdec.ll
+++ b/llvm/test/CodeGen/X86/slow-incdec.ll
@@ -84,7 +84,7 @@ define void @cond_ae_to_cond_ne(i32* %p) nounwind {
 ; INCDEC-NEXT:    incl (%eax)
 ; INCDEC-NEXT:    jne .LBB6_1
 ; INCDEC-NEXT:  # %bb.2: # %if.end4
-; INCDEC-NEXT:    jmp other # TAILCALL
+; INCDEC-NEXT:    jmp other at PLT # TAILCALL
 ; INCDEC-NEXT:  .LBB6_1: # %return
 ; INCDEC-NEXT:    retl
 ;
@@ -94,7 +94,7 @@ define void @cond_ae_to_cond_ne(i32* %p) nounwind {
 ; ADD-NEXT:    addl $1, (%eax)
 ; ADD-NEXT:    jne .LBB6_1
 ; ADD-NEXT:  # %bb.2: # %if.end4
-; ADD-NEXT:    jmp other # TAILCALL
+; ADD-NEXT:    jmp other at PLT # TAILCALL
 ; ADD-NEXT:  .LBB6_1: # %return
 ; ADD-NEXT:    retl
 entry:
@@ -131,9 +131,9 @@ define void @test_tail_call(i32* %ptr) nounwind {
 ; INCDEC-NEXT:    testb %al, %al
 ; INCDEC-NEXT:    jne .LBB7_2
 ; INCDEC-NEXT:  # %bb.1: # %then
-; INCDEC-NEXT:    jmp external_a # TAILCALL
+; INCDEC-NEXT:    jmp external_a at PLT # TAILCALL
 ; INCDEC-NEXT:  .LBB7_2: # %else
-; INCDEC-NEXT:    jmp external_b # TAILCALL
+; INCDEC-NEXT:    jmp external_b at PLT # TAILCALL
 ;
 ; ADD-LABEL: test_tail_call:
 ; ADD:       # %bb.0: # %entry
@@ -145,9 +145,9 @@ define void @test_tail_call(i32* %ptr) nounwind {
 ; ADD-NEXT:    testb %al, %al
 ; ADD-NEXT:    jne .LBB7_2
 ; ADD-NEXT:  # %bb.1: # %then
-; ADD-NEXT:    jmp external_a # TAILCALL
+; ADD-NEXT:    jmp external_a at PLT # TAILCALL
 ; ADD-NEXT:  .LBB7_2: # %else
-; ADD-NEXT:    jmp external_b # TAILCALL
+; ADD-NEXT:    jmp external_b at PLT # TAILCALL
 entry:
   %val = load i32, i32* %ptr
   %add_ov = call {i32, i1} @llvm.uadd.with.overflow.i32(i32 %val, i32 1)

diff  --git a/llvm/test/CodeGen/X86/tailcall.ll b/llvm/test/CodeGen/X86/tailcall.ll
index a710e9ae0519..b70c11e20c56 100644
--- a/llvm/test/CodeGen/X86/tailcall.ll
+++ b/llvm/test/CodeGen/X86/tailcall.ll
@@ -15,7 +15,7 @@ define fastcc i32 @tailcaller(i32 %in1, i32 %in2) nounwind {
 ; CHECK-NEXT:    movl %edx, {{[0-9]+}}(%esp)
 ; CHECK-NEXT:    movl %eax, {{[0-9]+}}(%esp)
 ; CHECK-NEXT:    addl $8, %esp
-; CHECK-NEXT:    jmp tailcallee # TAILCALL
+; CHECK-NEXT:    jmp tailcallee at PLT # TAILCALL
 entry:
   %tmp11 = tail call fastcc i32 @tailcallee(i32 %in1, i32 %in2, i32 %in1, i32 %in2)
   ret i32 %tmp11
@@ -26,7 +26,7 @@ declare fastcc i8* @alias_callee()
 define fastcc noalias i8* @noalias_caller() nounwind {
 ; CHECK-LABEL: noalias_caller:
 ; CHECK:       # %bb.0:
-; CHECK-NEXT:    jmp alias_callee # TAILCALL
+; CHECK-NEXT:    jmp alias_callee at PLT # TAILCALL
   %p = tail call fastcc i8* @alias_callee()
   ret i8* %p
 }
@@ -36,7 +36,7 @@ declare fastcc noalias i8* @noalias_callee()
 define fastcc i8* @alias_caller() nounwind {
 ; CHECK-LABEL: alias_caller:
 ; CHECK:       # %bb.0:
-; CHECK-NEXT:    jmp noalias_callee # TAILCALL
+; CHECK-NEXT:    jmp noalias_callee at PLT # TAILCALL
   %p = tail call fastcc noalias i8* @noalias_callee()
   ret i8* %p
 }
@@ -46,7 +46,7 @@ declare fastcc i32 @i32_callee()
 define fastcc i32 @ret_undef() nounwind {
 ; CHECK-LABEL: ret_undef:
 ; CHECK:       # %bb.0:
-; CHECK-NEXT:    jmp i32_callee # TAILCALL
+; CHECK-NEXT:    jmp i32_callee at PLT # TAILCALL
   %p = tail call fastcc i32 @i32_callee()
   ret i32 undef
 }
@@ -56,7 +56,7 @@ declare fastcc void @does_not_return()
 define fastcc i32 @noret() nounwind {
 ; CHECK-LABEL: noret:
 ; CHECK:       # %bb.0:
-; CHECK-NEXT:    jmp does_not_return # TAILCALL
+; CHECK-NEXT:    jmp does_not_return at PLT # TAILCALL
   tail call fastcc void @does_not_return()
   unreachable
 }


        


More information about the llvm-branch-commits mailing list