llvm-project/clang/test/Frontend
Hal Finkel c07e19b2c1 Add a loop's debug location to its llvm.loop metadata
Getting accurate locations for loops is important, because those locations are
used by the frontend to generate optimization remarks. Currently, optimization
remarks for loops often appear on the wrong line, often the first line of the
loop body instead of the loop itself. This is confusing because that line might
itself be another loop, or might be somewhere else completely if the body was
an inlined function call. This happens because of the way we find the loop's
starting location. First, we look for a preheader, and if we find one, and its
terminator has a debug location, then we use that. Otherwise, we look for a
location on an instruction in the loop header.

The fallback heuristic is not bad, but will almost always find the beginning of
the body, and not the loop statement itself. The preheader location search
often fails because there's often not a preheader, and even when there is a
preheader, depending on how it was formed, it sometimes carries the location of
some preceeding code.

I don't see any good theoretical way to fix this problem. On the other hand,
this seems like a straightforward solution: Put the debug location in the
loop's llvm.loop metadata. When emitting debug information, this commit causes
us to add the debug location as an operand to each loop's llvm.loop metadata.
Thus, we now generate this metadata for all loops (not just loops with
optimization hints) when we're otherwise generating debug information.

The remark test case changes depend on the companion LLVM commit r270771.

llvm-svn: 270772
2016-05-25 21:53:24 +00:00
..
Inputs Fix the sample profile format that breaks in test http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/505 2015-09-30 01:03:10 +00:00
Weverything.c
Wno-everything.c
ast-codegen.c Revert "Revert r241620 and follow-up commits" and move the initialization 2015-07-08 01:00:30 +00:00
ast-main.c
ast-main.cpp
backend-diagnostic.c Make '-Werror=frame-larger-than=' and associated diagnostic pragmas GCC-compatible 2014-06-09 23:59:38 +00:00
backend-option.c Pass -backend-option to LLVM when there is no target machine. 2016-04-12 20:22:32 +00:00
cc1-return-codes.c
cpp-output.c
darwin-eabi.c Fix r195149. Triple should correctly reflect that target. If it contains ios, 2014-01-26 23:12:43 +00:00
darwin-version.c Preprocessor: define correct tvOS and watchOS version macros 2015-10-30 16:30:30 +00:00
dependency-gen-escaping.c clang/test/Frontend/dependency-gen-escaping.c: Appease win32 hosts. Investigating. 2015-05-14 07:37:35 +00:00
dependency-gen.c Re-apply r267784, r267824 and r267830. 2016-04-28 17:09:37 +00:00
dependency-generation-crash.c Fix typo in my last commit. 2015-03-03 00:12:08 +00:00
diagnostics-option-names.c
disable-output.c Fix leak from r210059 2014-06-03 17:23:34 +00:00
embed-bitcode.ll Change embed-bitcode linkage type 2016-05-16 18:54:58 +00:00
exceptions.c Frontend: Define __EXCEPTIONS if -fexceptions is passed 2014-10-27 20:02:19 +00:00
force-include-not-found.c Add back null check removed accidentally in r250554 2015-10-20 18:45:57 +00:00
gnu-inline.c Make GNUInline consistent with whether we use traditional GNU inline semantics. 2015-05-13 22:07:22 +00:00
gnu-mcount.c Basic: fix profiling with GNU EABI 2016-04-12 03:05:03 +00:00
hexagon-target-basic.c
iframework.c
invalid-o-level.c Fix handling of invalid -O options. 2014-12-16 21:57:03 +00:00
ir-support-codegen.ll Override the datalayout in a module with -triple. 2013-12-20 22:01:25 +00:00
ir-support-errors.ll
ir-support.c Account for differences in grep implementations 2014-06-27 03:11:38 +00:00
lit.local.cfg Remove .bc from test config.suffixes 2014-06-27 02:04:21 +00:00
macros.c
mfpmath.c
mips-long-double.c
optimization-remark-analysis.c Add backend dignostic printer for unsupported features 2016-02-02 13:52:52 +00:00
optimization-remark-line-directive.c Stop messing with the 'g' group of options in CompilerInvocation. 2015-10-08 04:24:12 +00:00
optimization-remark-options.c Add a loop's debug location to its llvm.loop metadata 2016-05-25 21:53:24 +00:00
optimization-remark.c Use NoDebug compile units to mark debug metadata used only for sample-based 2016-04-08 22:43:06 +00:00
output-failures.c This test was updated in r216397, but was failing on Windows due to mixed path separators as well as case sensitivity of the "no" in "no such file or directory." Rather than revert this file back to its original form, I've made some incredibly ugly regexes so that it will pass everywhere. 2014-08-26 14:09:25 +00:00
plugin-annotate-functions.c Add a PragmaHandler Registry for plugins to add PragmaHandlers to 2016-04-04 14:22:58 +00:00
plugin-delayed-template.cpp Don't leak TemplateIds when a plugin parses late-parsed templates at TU end. 2015-05-17 01:07:16 +00:00
plugins.c Revert r260266 (and r260276), "clang-cl: Enable plugins on Windows" 2016-02-11 16:43:08 +00:00
preprocessed-output-macro-first-token.c
print-header-includes.c clang-cl: Include /FI headers in /showIncludes output. 2016-03-23 18:00:22 +00:00
profile-sample-use-loc-tracking.c Use NoDebug compile units to mark debug metadata used only for sample-based 2016-04-08 22:43:06 +00:00
rewrite-includes-bom.c Revert "clang/test/Driver/crash-report.c: This requires rewriter for -frewrite-includes. [PR20321]" 2014-07-16 15:12:48 +00:00
rewrite-includes-cli-include.c Revert "clang/test/Driver/crash-report.c: This requires rewriter for -frewrite-includes. [PR20321]" 2014-07-16 15:12:48 +00:00
rewrite-includes-eof.c Revert "clang/test/Driver/crash-report.c: This requires rewriter for -frewrite-includes. [PR20321]" 2014-07-16 15:12:48 +00:00
rewrite-includes-header-cmd-line.c Revert "clang/test/Driver/crash-report.c: This requires rewriter for -frewrite-includes. [PR20321]" 2014-07-16 15:12:48 +00:00
rewrite-includes-invalid-hasinclude.c Revert "clang/test/Driver/crash-report.c: This requires rewriter for -frewrite-includes. [PR20321]" 2014-07-16 15:12:48 +00:00
rewrite-includes-line-markers.c Add -fuse-line-directive flag to control usage of #line with -E 2015-02-26 00:17:25 +00:00
rewrite-includes-messages.c Revert "clang/test/Driver/crash-report.c: This requires rewriter for -frewrite-includes. [PR20321]" 2014-07-16 15:12:48 +00:00
rewrite-includes-missing.c Revert "clang/test/Driver/crash-report.c: This requires rewriter for -frewrite-includes. [PR20321]" 2014-07-16 15:12:48 +00:00
rewrite-includes-modules.c Commit some test changes somehow missed in r239789. 2015-06-16 00:19:29 +00:00
rewrite-includes-warnings.c Revert "clang/test/Driver/crash-report.c: This requires rewriter for -frewrite-includes. [PR20321]" 2014-07-16 15:12:48 +00:00
rewrite-includes.c Revert "clang/test/Driver/crash-report.c: This requires rewriter for -frewrite-includes. [PR20321]" 2014-07-16 15:12:48 +00:00
rewrite-macros.c Revert "clang/test/Driver/crash-report.c: This requires rewriter for -frewrite-includes. [PR20321]" 2014-07-16 15:12:48 +00:00
source-col-map.c This test requires UTF-8 output to print the UT-8 characters. 2015-09-11 13:29:12 +00:00
stdin.c
stdlang.c [OpenCL] Add predefined macros. 2016-04-26 19:25:46 +00:00
system-header-prefix.c Move the -i[no-]system-prefix options from CC1Options.td to Options.td. 2014-03-26 01:39:59 +00:00
trigraphs.cpp Add driver flags -ftrigraphs, -fno-trigraphs. 2014-12-23 22:32:37 +00:00
undef.c
unknown-pragmas.c
verify-directive.h
verify-fatal.c
verify-ignore-unexpected.c Add `-verify-ignore-unexpected` option to ignore unexpected diagnostics in VerifyDiagnosticsConsumer 2015-06-13 07:11:40 +00:00
verify-unknown-arg.c Destroy the diagnostic client first in ~DiagnosticEngine 2014-12-17 20:23:11 +00:00
verify.c Provide -verify support to match "any" line for diagnostics in included files. 2014-07-10 16:43:29 +00:00
verify2.c Provide -verify support to match "any" line for diagnostics in included files. 2014-07-10 16:43:29 +00:00
verify2.h Provide -verify support to match "any" line for diagnostics in included files. 2014-07-10 16:43:29 +00:00
verify3.c
warning-mapping-1.c
warning-mapping-2.c
warning-mapping-3.c
warning-mapping-4.c
warning-mapping-5.c
warning-options.cpp Use -Rblah, not -Wblah, to control remark diagnostics. This was always the 2014-08-07 00:24:21 +00:00
windows-nul.c Simplify test. No functional change intended. 2014-04-30 10:04:58 +00:00
x86-target-cpu.c Don't actually generate code for testing the frontend's target cpu flag, 2014-12-09 15:52:55 +00:00
x86_64-nacl-types.cpp Fix copy-paste errors in the test 2015-02-23 22:08:10 +00:00