[PATCH] D103988: SampleFDO] place the discriminator flag variable into the used list.
Rong Xu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 15 14:55:05 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG434fed5aff5e: [SampleFDO] Using common linkage for the discriminator flag variable (authored by xur).
Herald added a subscriber: pengfei.
Changed prior to commit:
https://reviews.llvm.org/D103988?vs=351549&id=352257#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103988/new/
https://reviews.llvm.org/D103988
Files:
llvm/lib/CodeGen/MIRFSDiscriminator.cpp
llvm/test/CodeGen/X86/fsafdo_test1.ll
llvm/test/CodeGen/X86/fsafdo_test2.ll
Index: llvm/test/CodeGen/X86/fsafdo_test2.ll
===================================================================
--- llvm/test/CodeGen/X86/fsafdo_test2.ll
+++ llvm/test/CodeGen/X86/fsafdo_test2.ll
@@ -43,12 +43,8 @@
; CHECK: .loc 1 23 9 is_stmt 0 discriminator 3623878657 # unroll.c:23:9
;;
;; Check that variable __llvm_fs_discriminator__ is generated.
-; CHECK: .type __llvm_fs_discriminator__, at object # @__llvm_fs_discriminator__
-; CHECK: .section .rodata,"a", at progbits
-; CHECK: .weak __llvm_fs_discriminator__
-; CHECK: __llvm_fs_discriminator__:
-; CHECK: .byte 1
-; CHECK: .size __llvm_fs_discriminator__, 1
+; CHECK: .type __llvm_fs_discriminator__, at object
+; CHECK: .comm __llvm_fs_discriminator__,1,1
target triple = "x86_64-unknown-linux-gnu"
Index: llvm/test/CodeGen/X86/fsafdo_test1.ll
===================================================================
--- llvm/test/CodeGen/X86/fsafdo_test1.ll
+++ llvm/test/CodeGen/X86/fsafdo_test1.ll
@@ -1,17 +1,13 @@
; RUN: llc -enable-fs-discriminator < %s | FileCheck %s
;
-; Check that fs-afdo discriminators are generated.
+;; Check that fs-afdo discriminators are generated.
; CHECK: .loc 1 7 3 is_stmt 0 discriminator 2 # foo.c:7:3
; Check: .loc 1 9 5 is_stmt 1 discriminator 2 # foo.c:9:5
; CHECK: .loc 1 9 5 is_stmt 0 discriminator 268435458 # foo.c:9:5
; CHECK: .loc 1 7 3 is_stmt 1 discriminator 3892314114 # foo.c:7:3
-; Check that variable __llvm_fs_discriminator__ is generated.
-; CHECK: .type __llvm_fs_discriminator__, at object # @__llvm_fs_discriminator__
-; CHECK: .section .rodata,"a", at progbits
-; CHECK: .weak __llvm_fs_discriminator__
-; CHECK: __llvm_fs_discriminator__:
-; CHECK: .byte 1
-; CHECK: .size __llvm_fs_discriminator__, 1
+;; Check that variable __llvm_fs_discriminator__ is generated.
+; CHECK: .type __llvm_fs_discriminator__, at object
+; CHECK: .comm __llvm_fs_discriminator__,1,1
target triple = "x86_64-unknown-linux-gnu"
Index: llvm/lib/CodeGen/MIRFSDiscriminator.cpp
===================================================================
--- llvm/lib/CodeGen/MIRFSDiscriminator.cpp
+++ llvm/lib/CodeGen/MIRFSDiscriminator.cpp
@@ -132,9 +132,10 @@
if (!M->getGlobalVariable(FSDiscriminatorVar)) {
auto &Context = M->getContext();
// Create a global variable to flag that FSDiscriminators are used.
- new GlobalVariable(*M, Type::getInt1Ty(Context), true,
- GlobalValue::WeakAnyLinkage,
- ConstantInt::getTrue(Context), FSDiscriminatorVar);
+ // Using "common" linkage so that it will not gc GC'ed.
+ new GlobalVariable(*M, Type::getInt1Ty(Context), false,
+ GlobalValue::CommonLinkage,
+ ConstantInt::getFalse(Context), FSDiscriminatorVar);
}
LLVM_DEBUG(dbgs() << "Num of FS Discriminators: " << NumNewD << "\n");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103988.352257.patch
Type: text/x-patch
Size: 2910 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210615/0be322fb/attachment.bin>
More information about the llvm-commits
mailing list