Index: lib/CodeGen/CGStmt.cpp =================================================================== --- lib/CodeGen/CGStmt.cpp +++ lib/CodeGen/CGStmt.cpp @@ -549,7 +549,10 @@ if (S.getElse()) ElseBlock = createBasicBlock("if.else"); - EmitBranchOnBoolExpr(S.getCond(), ThenBlock, ElseBlock, Cnt.getCount()); + { + ApplyDebugLocation DL(*this, S.getCond()->getSourceRange().getEnd()); + EmitBranchOnBoolExpr(S.getCond(), ThenBlock, ElseBlock, Cnt.getCount()); + } // Emit the 'then' code. EmitBlock(ThenBlock); Index: test/CodeGenCXX/debug-info-line.cpp =================================================================== --- test/CodeGenCXX/debug-info-line.cpp +++ test/CodeGenCXX/debug-info-line.cpp @@ -217,6 +217,8 @@ void f18(int a, int b) { // CHECK: icmp {{.*}}, !dbg [[DBG_F18_1:![0-9]*]] // CHECK: br {{.*}}, !dbg [[DBG_F18_2:![0-9]*]] +// CHECK: icmp {{.*}}, !dbg [[DBG_F18_3:![0-9]*]] +// CHECK: br {{.*}}, !dbg [[DBG_F18_3]] #line 2000 if (a // && // @@ -228,6 +230,8 @@ void f19(int a, int b) { // CHECK: icmp {{.*}}, !dbg [[DBG_F19_1:![0-9]*]] // CHECK: br {{.*}}, !dbg [[DBG_F19_2:![0-9]*]] +// CHECK: icmp {{.*}}, !dbg [[DBG_F19_3:![0-9]*]] +// CHECK: br {{.*}}, !dbg [[DBG_F19_3]] #line 2100 if (a // || // @@ -317,8 +321,10 @@ // CHECK: [[DBG_F17]] = !MDLocation(line: 1900, // CHECK: [[DBG_F18_1]] = !MDLocation(line: 2000, // CHECK: [[DBG_F18_2]] = !MDLocation(line: 2001, +// CHECK: [[DBG_F18_3]] = !MDLocation(line: 2002, // CHECK: [[DBG_F19_1]] = !MDLocation(line: 2100, // CHECK: [[DBG_F19_2]] = !MDLocation(line: 2101, +// CHECK: [[DBG_F19_3]] = !MDLocation(line: 2102, // CHECK: [[DBG_F20_1]] = !MDLocation(line: 2200, // CHECK: [[DBG_F23]] = !MDLocation(line: 2500, // CHECK: [[DBG_F24]] = !MDLocation(line: 2600,