// where it becomes safe again so stop debugifying here.
DebugifyIsSafe = false;
+ // Add a FSDiscriminator pass right before RA, so that we could get
+ // more precise SampleFDO profile for RA.
+ if (EnableFSDiscriminator)
+ addPass(createMIRAddFSDiscriminatorsPass(
+ sampleprof::FSDiscriminatorPass::Pass1));
+
// Run register allocation and passes that are tightly coupled with it,
// including phi elimination and scheduling.
if (getOptimizeRegAlloc())
/// Add standard basic block placement passes.
void TargetPassConfig::addBlockPlacement() {
+ if (EnableFSDiscriminator)
+ addPass(createMIRAddFSDiscriminatorsPass(
+ sampleprof::FSDiscriminatorPass::Pass2));
if (addPass(&MachineBlockPlacementID)) {
// Run a separate pass to collect block placement statistics.
if (EnableBlockPlacementStats)
; 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: .loc 1 9 5 is_stmt 0 discriminator 11266 # foo.c:9:5
+; CHECK: .loc 1 7 3 is_stmt 1 discriminator 11266 # foo.c:7:3
; Check that variable __llvm_fs_discriminator__ is generated.
; CHECK: .type __llvm_fs_discriminator__,@object # @__llvm_fs_discriminator__
; CHECK: .section .rodata,"a",@progbits
;;
;; Check that fs-afdo discriminators are generated.
; CHECK: .loc 1 23 9 is_stmt 0 discriminator 1 # unroll.c:23:9
-; CHECK: .loc 1 23 9 is_stmt 0 discriminator 3892314113 # unroll.c:23:9
-; CHECK: .loc 1 23 9 is_stmt 0 discriminator 2818572289 # unroll.c:23:9
-; CHECK: .loc 1 23 9 is_stmt 0 discriminator 3623878657 # unroll.c:23:9
+; CHECK: .loc 1 23 9 is_stmt 0 discriminator 3585 # unroll.c:23:9
+; CHECK: .loc 1 23 9 is_stmt 0 discriminator 8705 # unroll.c:23:9
+; CHECK: .loc 1 23 9 is_stmt 0 discriminator 4097 # unroll.c:23:9
;;
;; Check that variable __llvm_fs_discriminator__ is generated.
; CHECK: .type __llvm_fs_discriminator__,@object # @__llvm_fs_discriminator__