Index: lib/CodeGen/BackendUtil.cpp =================================================================== --- lib/CodeGen/BackendUtil.cpp +++ lib/CodeGen/BackendUtil.cpp @@ -453,10 +453,9 @@ MPM.add(createInstrProfilingLegacyPass(Options)); } if (CodeGenOpts.hasProfileIRInstr()) { + PMBuilder.EnablePGOInstrGen = true; if (!CodeGenOpts.InstrProfileOutput.empty()) PMBuilder.PGOInstrGen = CodeGenOpts.InstrProfileOutput; - else - PMBuilder.PGOInstrGen = "default.profraw"; } if (CodeGenOpts.hasProfileIRUse()) PMBuilder.PGOInstrUse = CodeGenOpts.ProfileInstrumentUsePath; Index: test/Profile/gcc-flag-compatibility.c =================================================================== --- test/Profile/gcc-flag-compatibility.c +++ test/Profile/gcc-flag-compatibility.c @@ -7,11 +7,10 @@ // -fprofile-use= Uses the profile file /default.profdata // -fprofile-use=/file Uses the profile file /file -// FIXME: IRPGO shouldn't use the override API when no profraw name is given. -// Check that -fprofile-generate overrides the default profraw. +// Check that -fprofile-generate doesn't use the override API. // RUN: %clang %s -c -S -o - -emit-llvm -fprofile-generate | FileCheck -check-prefix=PROFILE-GEN %s -// PROFILE-GEN: call void @__llvm_profile_override_default_filename -// PROFILE-GEN: declare void @__llvm_profile_override_default_filename(i8*) +// PROFILE-GEN-NOT: call void @__llvm_profile_override_default_filename +// PROFILE-GEN-NOT: declare void @__llvm_profile_override_default_filename(i8*) // Check that -fprofile-generate=/path/to generates /path/to/default.profraw // RUN: %clang %s -c -S -o - -emit-llvm -fprofile-generate=/path/to | FileCheck -check-prefix=PROFILE-GEN-EQ %s