Skip to content

Commit b6f9270

Browse files
committed
Don't emit optimization remarks if we don't have a debug location
1 parent c8c7d2b commit b6f9270

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/SIL/OptimizationRemark.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ Emitter::Emitter(StringRef PassName, SILModule &M)
7777
template <typename RemarkT, typename... ArgTypes>
7878
static void emitRemark(SILModule &Module, const Remark<RemarkT> &R,
7979
Diag<ArgTypes...> ID, bool DiagEnabled) {
80+
if (R.getLocation().isInvalid())
81+
return;
8082
if (auto *Out = Module.getOptRecordStream())
8183
// YAMLTraits takes a non-const reference even when outputting.
8284
*Out << const_cast<Remark<RemarkT> &>(R);

0 commit comments

Comments
 (0)