diff --git a/polly/lib/Analysis/ScopDetectionDiagnostic.cpp b/polly/lib/Analysis/ScopDetectionDiagnostic.cpp index 2eff1f81eed0..4c71f17ced37 100644 --- a/polly/lib/Analysis/ScopDetectionDiagnostic.cpp +++ b/polly/lib/Analysis/ScopDetectionDiagnostic.cpp @@ -134,6 +134,9 @@ void emitRejectionRemarks(const BBPair &P, const RejectLog &Log) { if (const DebugLoc &Loc = RR->getDebugLoc()) emitOptimizationRemarkMissed(Ctx, DEBUG_TYPE, F, Loc, RR->getEndUserMessage()); + else + emitOptimizationRemarkMissed(Ctx, DEBUG_TYPE, F, Begin, + RR->getEndUserMessage()); } emitOptimizationRemarkMissed(Ctx, DEBUG_TYPE, F, End, diff --git a/polly/test/ScopDetectionDiagnostics/ReportIrreducibleRegionWithoutDebugLoc.ll b/polly/test/ScopDetectionDiagnostics/ReportIrreducibleRegionWithoutDebugLoc.ll new file mode 100644 index 000000000000..612de83c3e83 --- /dev/null +++ b/polly/test/ScopDetectionDiagnostics/ReportIrreducibleRegionWithoutDebugLoc.ll @@ -0,0 +1,26 @@ +; RUN: opt %loadPolly -analyze -polly-detect \ +; RUN: -pass-remarks-missed="polly-detect" \ +; RUN: < %s 2>&1| FileCheck %s + +; CHECK: remark: :0:0: Irreducible region encountered in control flow. + +define void @hoge(i8* %arg) { +bb1: + br i1 false, label %bb2, label %bb3 + +bb2: + br i1 false, label %bb4, label %bb5 + +bb4: + br i1 false, label %bb3, label %bb5 + +bb5: + br label %bb6 + +bb6: + br label %bb4 + +bb3: + ret void +} +