platform/upstream/llvm.git
5 years ago[fix][clang-tidy] fix for r345961 that introduced a test failure on Windows builds
Jonas Toth [Fri, 2 Nov 2018 16:36:21 +0000 (16:36 +0000)]
[fix][clang-tidy] fix for r345961 that introduced a test failure on Windows builds

r345961 introduced a path check in
.\tools\clang\tools\extra\test\clang-tidy\clang-tidy-run-with-database.cpp.

r345961 added a check line for a path that only handled / on unix
machines and not \ on windows machines.

This patch handles both cases.

Patch by TWeaver.

Differential Revision: https://reviews.llvm.org/D54036

llvm-svn: 345995

5 years agoDidn't -> didnt, because #errors complains about untermianted '
Kristof Umann [Fri, 2 Nov 2018 16:32:15 +0000 (16:32 +0000)]
Didn't -> didnt, because #errors complains about untermianted '

llvm-svn: 345993

5 years ago[analyzer] Fix diagnostics/explicit-suppression.cpp
Fangrui Song [Fri, 2 Nov 2018 16:23:37 +0000 (16:23 +0000)]
[analyzer] Fix diagnostics/explicit-suppression.cpp

*OI++ = *II++ is on line 670, not 668

llvm-svn: 345992

5 years ago[OPENMP][NVPTX]Use __kmpc_data_sharing_coalesced_push_stack function.
Alexey Bataev [Fri, 2 Nov 2018 16:08:31 +0000 (16:08 +0000)]
[OPENMP][NVPTX]Use __kmpc_data_sharing_coalesced_push_stack function.

Coalesced memory access requires use of the new function
`__kmpc_data_sharing_coalesced_push_stack` instead of the
`__kmpc_data_sharing_push_stack`.

llvm-svn: 345991

5 years ago[analyzer] Put llvm.Conventions back in alpha
Kristof Umann [Fri, 2 Nov 2018 16:02:10 +0000 (16:02 +0000)]
[analyzer] Put llvm.Conventions back in alpha

Interestingly, this many year old (when I last looked I remember 2010ish)
checker was committed without any tests, so I thought I'd implement them, but I
was shocked to see how I barely managed to get it working. The code is severely
outdated, I'm not even sure it has ever been used, so I'd propose to move it
back into alpha, and possibly even remove it.

Differential Revision: https://reviews.llvm.org/D53856

llvm-svn: 345990

5 years ago[analyzer] New flag to print all -analyzer-config options
Kristof Umann [Fri, 2 Nov 2018 15:59:37 +0000 (15:59 +0000)]
[analyzer] New flag to print all -analyzer-config options

A new -cc1 flag is avaible for the said purpose: -analyzer-config-help

Differential Revision: https://reviews.llvm.org/D53296

llvm-svn: 345989

5 years ago[ValueTracking] allow non-canonical shuffles when computing signbits
Sanjay Patel [Fri, 2 Nov 2018 15:51:47 +0000 (15:51 +0000)]
[ValueTracking] allow non-canonical shuffles when computing signbits

This possibility is noted in D53987 for a different case,
so we need to adjust the existing code.

llvm-svn: 345988

5 years ago[NFC] Remove some extra characters from docs/LangRef.rst
Cameron McInally [Fri, 2 Nov 2018 15:51:43 +0000 (15:51 +0000)]
[NFC] Remove some extra characters from docs/LangRef.rst

llvm-svn: 345987

5 years ago[analyzer][NFC] Collect all -analyzer-config options in a .def file
Kristof Umann [Fri, 2 Nov 2018 15:50:44 +0000 (15:50 +0000)]
[analyzer][NFC] Collect all -analyzer-config options in a .def file

I'm in the process of refactoring AnalyzerOptions. The main motivation behind
here is to emit warnings if an invalid -analyzer-config option is given from the
command line, and be able to list them all.

In this patch, I'm moving all analyzer options to a def file, and move 2 enums
to global namespace.

Differential Revision: https://reviews.llvm.org/D53277

llvm-svn: 345986

5 years ago[analyzer][NFC] Fix some incorrect uses of -analyzer-config options
Kristof Umann [Fri, 2 Nov 2018 15:48:10 +0000 (15:48 +0000)]
[analyzer][NFC] Fix some incorrect uses of -analyzer-config options

I'm in the process of refactoring AnalyzerOptions. The main motivation behind
here is to emit warnings if an invalid -analyzer-config option is given from
the command line, and be able to list them all.

In this patch, I found some flags that should've been used as checker options,
or have absolutely no mention of in AnalyzerOptions, or are nonexistent.

- NonLocalizedStringChecker now uses its "AggressiveReport" flag as a checker
    option
- lib/StaticAnalyzer/Frontend/ModelInjector.cpp now accesses the "model-path"
    option through a getter in AnalyzerOptions
- -analyzer-config path-diagnostics-alternate=false is not a thing, I removed it,
- lib/StaticAnalyzer/Checkers/AllocationDiagnostics.cpp and
    lib/StaticAnalyzer/Checkers/AllocationDiagnostics.h are weird, they actually
    only contain an option getter. I deleted them, and fixed RetainCountChecker
    to get it's "leak-diagnostics-reference-allocation" option as a checker option,
- "region-store-small-struct-limit" has a proper getter now.

Differential Revision: https://reviews.llvm.org/D53276

llvm-svn: 345985

5 years ago[clang-tidy] Fixed code sample in a comment. NFC
Alexander Kornienko [Fri, 2 Nov 2018 15:29:37 +0000 (15:29 +0000)]
[clang-tidy] Fixed code sample in a comment. NFC

llvm-svn: 345984

5 years ago[NFC] Refactor initialisation of Darwin malloc zone fields into separate function...
Dan Liew [Fri, 2 Nov 2018 15:28:11 +0000 (15:28 +0000)]
[NFC] Refactor initialisation of Darwin malloc zone fields into separate function called `InitMallocZoneFields()` which is now called from `ReplaceSystemMalloc()`.

Summary:
The motivation here is to be able support initialisation of the
malloc zone on other code paths.

rdar://problem/45284065

Reviewers: kubamracek, george.karpenkov

Subscribers: llvm-commits, #sanitizers

Differential Revision: https://reviews.llvm.org/D54037

llvm-svn: 345983

5 years ago[OPENMP]Change the mapping type for lambda captures.
Alexey Bataev [Fri, 2 Nov 2018 15:25:06 +0000 (15:25 +0000)]
[OPENMP]Change the mapping type for lambda captures.

The previously used combination `PTR_AND_OBJ | PRIVATE` could be used for mapping of some data in Fortran. Changed it to `PTR_AND_OBJ | LITERAL`.

llvm-svn: 345982

5 years ago[OPENMP][OFFLOADING]Change the lambda capturing flags.
Alexey Bataev [Fri, 2 Nov 2018 15:24:47 +0000 (15:24 +0000)]
[OPENMP][OFFLOADING]Change the lambda capturing flags.

Summary:
The previously used combination `PTR_AND_OBJ | PRIVATE` could be used
for mapping of some data in Fortran. Changed it to `PTR_AND_OBJ |
  LITERAL`.

Reviewers: gtbercea

Subscribers: guansong, caomhin, openmp-commits

Differential Revision: https://reviews.llvm.org/D54035

llvm-svn: 345981

5 years agoRevert "Change the timestamp of llvmcache-foo file to meet the thinLTO prune policy"
Teresa Johnson [Fri, 2 Nov 2018 15:22:19 +0000 (15:22 +0000)]
Revert "Change  the timestamp of llvmcache-foo file to meet the thinLTO prune policy"

This reverts commit r345977.

A few bots failing because the invocation of "touch" is not accepted on
a couple other OSes. Specifically the -d argument is not accepted or requires
a different format.

http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/27103/steps/test_lld/logs/stdio
http://lab.llvm.org:8011/builders/lld-x86_64-freebsd/builds/24974/steps/test_lld/logs/stdio

llvm-svn: 345980

5 years ago[clang-tidy] .reset(new X) -> make_unique<X>() in a comment. NFC
Alexander Kornienko [Fri, 2 Nov 2018 15:03:43 +0000 (15:03 +0000)]
[clang-tidy] .reset(new X) -> make_unique<X>() in a comment. NFC

llvm-svn: 345979

5 years ago[OPENMP][NVPTX]Improve emission of the globalized variables for
Alexey Bataev [Fri, 2 Nov 2018 14:54:07 +0000 (14:54 +0000)]
[OPENMP][NVPTX]Improve emission of the globalized variables for
target/teams/distribute regions.

Target/teams/distribute regions exist for all the time the kernel is
executed. Thus, if the variable is declared in their context and then
escape it, we can allocate global memory statically instead of
allocating it dynamically.
Patch captures all the globalized variables in target/teams/distribute
contexts, merges them into the records, one per each target region.
Those records are then joined into the union, one per compilation unit
(to save the global memory). Those units are organized into
2 x dimensional arrays, where the first dimension is
the number of blocks per SM and the second one is the number of SMs.
Runtime functions manage this global memory space between the executing
teams.

llvm-svn: 345978

5 years agoChange the timestamp of llvmcache-foo file to meet the thinLTO prune policy
Teresa Johnson [Fri, 2 Nov 2018 14:52:10 +0000 (14:52 +0000)]
Change  the timestamp of llvmcache-foo file to meet the thinLTO prune policy

Summary:

The case may randomly fail if we test it with command "
 while llvm-lit tools/lld/test/ELF/lto/cache.ll; do true; done". It is because the llvmcache-foo file is younger than llvmcache-349F039B8EB076D412007D82778442BED3148C4E and llvmcache-A8107945C65C2B2BBEE8E61AA604C311D60D58D6. But due to timestamp precision reason their timestamp is the same. Given the same timestamp, the file prune policy is to remove bigger size file first, so mostly foo file is removed for its bigger size. And the files size is under threshold after deleting foo file. That's what test case expect.

However sometimes, the precision is enough to measure that timestamp of llvmcache-349F039B8EB076D412007D82778442BED3148C4E and llvmcache-A8107945C65C2B2BBEE8E61AA604C311D60D58D6 are smaller than foo, so llvmcache-349F039B8EB076D412007D82778442BED3148C4E and llvmcache-A8107945C65C2B2BBEE8E61AA604C311D60D58D6 are deleted first. Since the files size is still above the file size threshold after deleting the 2 files, the foo file is also deleted. And then the test case fails, because it expect only one file should be deleted instead of 3.

The fix is to change the timestamp of llvmcache-foo file to meet the thinLTO prune policy.
The same fix is applied to llvm code at https://reviews.llvm.org/D52452.

Patch by Luo Yuanke.

Reviewers: ruiu, craig.topper, smaslov, Jianping, espindola, LuoYuanke

Subscribers: rupprecht, bjope, emaste, inglorion, arichardson, steven_wu, dexonsmith, llvm-commits

Differential Revision: https://reviews.llvm.org/D53123

llvm-svn: 345977

5 years ago[OPENMP][NVPTX]Fixed/improved support for globalization in team contexts.
Alexey Bataev [Fri, 2 Nov 2018 14:43:23 +0000 (14:43 +0000)]
[OPENMP][NVPTX]Fixed/improved support for globalization in team contexts.

Summary:
Current globalization scheme works correctly only for SPMD+lightweight
runtime mode and does not work for full runtime. Patch improves support
for the globalization scheme + reduces global memory consumption in
  lightweight runtime mode.
Patch adds runtime functions to work with the statically allocated
global memory. It allows to improve performance and memory consumption.
This global memory must be allocated by the compiler.

Reviewers: grokos, kkwli0, gtbercea, caomhin

Subscribers: guansong, jfb, openmp-commits

Differential Revision: https://reviews.llvm.org/D53943

llvm-svn: 345976

5 years ago[Hexagon] Do not reduce load size for globals in small-data
Krzysztof Parzyszek [Fri, 2 Nov 2018 14:17:47 +0000 (14:17 +0000)]
[Hexagon] Do not reduce load size for globals in small-data

Small-data (i.e. GP-relative) loads and stores allow 16-bit scaled
offset. For a load of a value of type T, the small-data area is
equivalent to an array "T sdata[65536]". This implies that objects
of smaller sizes need to be closer to the beginning of sdata,
while larger objects may be farther away, or otherwise the offset
may be insufficient to reach it. Similarly, an object of a larger
size should not be accessed via a load of a smaller size.

llvm-svn: 345975

5 years ago[NativePDB] Make tests work on x86 too
Aleksandr Urakov [Fri, 2 Nov 2018 14:15:29 +0000 (14:15 +0000)]
[NativePDB] Make tests work on x86 too

Summary:
This patch fixes the NativePDB tests to make them work from x86 command line too

Reviewers: zturner, stella.stamenova

Subscribers: aleksandr.urakov, teemperor, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D54031

llvm-svn: 345974

5 years ago[clangd] Add fallbackFlags initialization extension.
Sam McCall [Fri, 2 Nov 2018 14:07:51 +0000 (14:07 +0000)]
[clangd] Add fallbackFlags initialization extension.

Summary:
This allows customizing the flags used when no compile database is
available. It addresses some uses of the old extraFlags extension.

Reviewers: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Differential Revision: https://reviews.llvm.org/D53688

llvm-svn: 345973

5 years ago[DEBUGINFO, NVPTX]DO not emit ',debug' option if no debug info or only debug directiv...
Alexey Bataev [Fri, 2 Nov 2018 13:47:47 +0000 (13:47 +0000)]
[DEBUGINFO, NVPTX]DO not emit ',debug' option if no debug info or only debug directives are requested.

Summary:
If the output of debug directives only is requested, we should drop
emission of ',debug' option from the target directive. Required for
supporting of nvprof profiler.

Reviewers: probinson, echristo, dblaikie

Subscribers: Hahnfeld, jholewinski, llvm-commits, JDevlieghere, aprantl

Differential Revision: https://reviews.llvm.org/D46061

llvm-svn: 345972

5 years agoReapply Logging: make os_log buffer size an integer constant expression.
Tim Northover [Fri, 2 Nov 2018 13:14:11 +0000 (13:14 +0000)]
Reapply Logging: make os_log buffer size an integer constant expression.

The size of an os_log buffer is known at any stage of compilation, so making it
a constant expression means that the common idiom of declaring a buffer for it
won't result in a VLA. That allows the compiler to skip saving and restoring
the stack pointer around such buffers.

This also moves the OSLog and other FormatString helpers from
libclangAnalysis to libclangAST to avoid a circular dependency.

llvm-svn: 345971

5 years ago[clangd] Make in-memory CDB always available as an overlay, refactor.
Sam McCall [Fri, 2 Nov 2018 13:09:36 +0000 (13:09 +0000)]
[clangd] Make in-memory CDB always available as an overlay, refactor.

Summary:
The new implementation is a GlobalCompilationDatabase that overlays a base.
Normally this is the directory-based CDB.
To preserve the behavior of compile_args_from=LSP, the base may be null.

The OverlayCDB is always present, and so the extensions to populate it
are always supported.

It also allows overriding the flags of the fallback command. This is
just unit-tested for now, but the plan is to expose this as an extension
on the initialize message. This addresses use cases like
https://github.com/thomasjo/atom-ide-cpp/issues/16

Reviewers: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Differential Revision: https://reviews.llvm.org/D53687

llvm-svn: 345970

5 years ago[clangd] Remove didOpen extraFlags extension.
Sam McCall [Fri, 2 Nov 2018 13:06:55 +0000 (13:06 +0000)]
[clangd] Remove didOpen extraFlags extension.

Summary:
This was added in D34947 to support YCM, but YCM actually provides *all* args,
and this was never actually used.
Meanwhile, we grew another extension that allows specifying all args.

I did find one user of this extension: https://github.com/thomasjo/atom-ide-cpp.
I'll reach out, there are multiple good alternatives:
 - compile_commands.txt can serve the same purpose as .clang_complete there
 - we can add an extension to support setting the fallback command

Reviewers: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Differential Revision: https://reviews.llvm.org/D53641

llvm-svn: 345969

5 years ago[clangd] Only log ignored diagnostics with -log=verbose.
Sam McCall [Fri, 2 Nov 2018 12:51:26 +0000 (12:51 +0000)]
[clangd] Only log ignored diagnostics with -log=verbose.

Reviewers: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Differential Revision: https://reviews.llvm.org/D53648

llvm-svn: 345968

5 years agoAdd support for 'atomic_default_mem_order' clause on 'requires' directive. Also renam...
Patrick Lyster [Fri, 2 Nov 2018 12:18:11 +0000 (12:18 +0000)]
Add support for 'atomic_default_mem_order' clause on 'requires' directive. Also renamed test files relating to 'requires'. Differntial review: https://reviews.llvm.org/D53513

llvm-svn: 345967

5 years agoAllow null-valued function operands in getCalledFunction()
David Stenberg [Fri, 2 Nov 2018 11:46:24 +0000 (11:46 +0000)]
Allow null-valued function operands in getCalledFunction()

Summary:
Change the dynamic cast in CallBase::getCalledFunction() to allow
null-valued function operands.

This patch fixes a crash that occurred when a funtion operand of a
call instruction was dropped, and later on a metadata-carrying
instruction was printed out. When allocating the metadata slot numbers,
getCalledFunction() would be invoked on the call with the dropped
operand, resulting in a failed non-null assertion in isa<>.

This fixes PR38924, in which a printout in DBCE crashed due to this.

This aligns getCalledFunction() with getCalledValue(), as the latter
allows the operand to be null.

Reviewers: vsk, dexonsmith, hfinkel

Reviewed By: dexonsmith

Subscribers: hfinkel, llvm-commits

Differential Revision: https://reviews.llvm.org/D52537

llvm-svn: 345966

5 years ago[analyzer][CTU] Correctly signal in the function index generation tool if there was...
Gabor Horvath [Fri, 2 Nov 2018 11:22:22 +0000 (11:22 +0000)]
[analyzer][CTU] Correctly signal in the function index generation tool if there was an error

Differential Revision: https://reviews.llvm.org/D53979

llvm-svn: 345965

5 years ago[DAGCombiner] Remove reduceBuildVecConvertToConvertBuildVec and rely on the vectorize...
Simon Pilgrim [Fri, 2 Nov 2018 11:06:18 +0000 (11:06 +0000)]
[DAGCombiner] Remove reduceBuildVecConvertToConvertBuildVec and rely on the vectorizers instead (PR35732)

reduceBuildVecConvertToConvertBuildVec vectorizes int2float in the DAGCombiner, which means that even if the LV/SLP has decided to keep scalar code using the cost models, this will override this.

While there are cases where vectorization is necessary in the DAG (mainly due to legalization artefacts), I don't think this is the case here, we should assume that the vectorizers know what they are doing.

Differential Revision: https://reviews.llvm.org/D53712

llvm-svn: 345964

5 years agoRevert "Fix regression in behavior of clang -x c++-header -fmodule-name=XXX"
Ilya Biryukov [Fri, 2 Nov 2018 10:50:26 +0000 (10:50 +0000)]
Revert "Fix regression in behavior of clang -x c++-header -fmodule-name=XXX"

This reverts commit r345803 and r345915 (a follow-up fix to r345803).

Reason: r345803 blocks our internal integrate because of the new
warnings showing up in too many places. The fix is actually correct,
we will reland it after figuring out how to integrate properly.

llvm-svn: 345963

5 years ago[AMDGPU] UBSan bug fix for r345710
Neil Henning [Fri, 2 Nov 2018 10:24:57 +0000 (10:24 +0000)]
[AMDGPU] UBSan bug fix for r345710

UBSan detected an error in our ISelLowering that is exposed only when
you have a dmask == 0x1. Fix this by adding in an explicit check to
ensure we don't do the UBSan detected shl << 32.

llvm-svn: 345962

5 years ago[clang-tidy] Get ClangTidyContext out of the business of storing diagnostics. NFC
Sam McCall [Fri, 2 Nov 2018 10:01:59 +0000 (10:01 +0000)]
[clang-tidy] Get ClangTidyContext out of the business of storing diagnostics. NFC

Summary:
Currently ClangTidyContext::diag() sends the diagnostics to a
DiagnosticsEngine, which probably delegates to a ClangTidyDiagnosticsConsumer,
which is supposed to go back and populate ClangTidyContext::Errors.

After this patch, the diagnostics are stored in the ClangTidyDiagnosticsConsumer
itself and can be retrieved from there.

Why?
 - the round-trip from context -> engine -> consumer -> context is confusing
   and makes it harder to establish layering between these things.
 - context does too many things, and makes it hard to use clang-tidy as a library
 - everyone who actually wants the diagnostics has access to the ClangTidyDiagnosticsConsumer

The most natural implementation (ClangTidyDiagnosticsConsumer::take()
finalizes diagnostics) causes a test failure: clang-tidy-run-with-database.cpp
asserts that clang-tidy exits successfully when trying to process a file
that doesn't exist.
In clang-tidy today, this happens because finish() is never called, so the
diagnostic is never flushed. This looks like a bug to me.
For now, this patch carefully preserves that behavior, but I'll ping the
authors to see whether it's deliberate and worth preserving.

Reviewers: hokein

Subscribers: xazax.hun, cfe-commits, alexfh

Differential Revision: https://reviews.llvm.org/D53953

llvm-svn: 345961

5 years agoFix a typo in a function name
Alex Denisov [Fri, 2 Nov 2018 09:57:24 +0000 (09:57 +0000)]
Fix a typo in a function name

Declaration and definition have slightly different names with a typo in the
declaration, which leads to a link error.
See the following bug report for more details: https://bugs.llvm.org/show_bug.cgi?id=39523

llvm-svn: 345960

5 years ago[LV] Avoid vectorizing loops under opt for size that involve SCEV checks
Ayal Zaks [Fri, 2 Nov 2018 09:16:12 +0000 (09:16 +0000)]
[LV] Avoid vectorizing loops under opt for size that involve SCEV checks

Fix PR39417, PR39497

The loop vectorizer may generate runtime SCEV checks for overflow and stride==1
cases, leading to execution of original scalar loop. The latter is forbidden
when optimizing for size. An assert introduced in r344743 triggered the above
PR's showing it does happen. This patch fixes this behavior by preventing
vectorization in such cases.

Differential Revision: https://reviews.llvm.org/D53612

llvm-svn: 345959

5 years ago[LLDB] - Add support for DW_FORM_rnglistx and relative DW_RLE_* entries.
George Rimar [Fri, 2 Nov 2018 09:03:25 +0000 (09:03 +0000)]
[LLDB] - Add support for DW_FORM_rnglistx and relative DW_RLE_* entries.

This adds support for DW_RLE_base_addressx, DW_RLE_startx_endx,
DW_RLE_startx_length, DW_FORM_rnglistx.

Differential revision: https://reviews.llvm.org/D53929

llvm-svn: 345958

5 years ago[Symbol] Search symbols with name and type in a symbol file
Aleksandr Urakov [Fri, 2 Nov 2018 08:54:35 +0000 (08:54 +0000)]
[Symbol] Search symbols with name and type in a symbol file

Summary:
This patch adds possibility of searching a public symbol with name and type in a
symbol file. It is helpful when working with PE, because PE's symtabs contain
only imported / exported symbols only. Such a search is required for e.g.
evaluation of an expression that calls some function of the debuggee.

Reviewers: zturner, asmith, labath, clayborg, espindola

Reviewed By: clayborg

Subscribers: emaste, arichardson, aleksandr.urakov, jingham, lldb-commits, stella.stamenova

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D53368

llvm-svn: 345957

5 years ago[Windows] Fix Windows build after be053dd5a384a03da5a77552686900ddc7bfc178
Aleksandr Urakov [Fri, 2 Nov 2018 08:47:33 +0000 (08:47 +0000)]
[Windows] Fix Windows build after be053dd5a384a03da5a77552686900ddc7bfc178

llvm-svn: 345956

5 years ago[XRay] Fix tests with updated fdr-dump
Dean Michael Berris [Fri, 2 Nov 2018 08:35:46 +0000 (08:35 +0000)]
[XRay] Fix tests with updated fdr-dump

Follow-up to D54022.

llvm-svn: 345955

5 years ago[XRay] Update delta computations in runtime
Dean Michael Berris [Fri, 2 Nov 2018 08:07:38 +0000 (08:07 +0000)]
[XRay] Update delta computations in runtime

Summary:
Fix some issues discovered from mostly manual inspection of outputs from
the `llvm-xray fdr-dump` tool.

It turns out we haven't been writing the deltas properly, and have been
writing down zeros for deltas of some records. This change fixes this
oversight born by the recent refactoring.

Reviewers: mboerger

Subscribers: llvm-commits, hiraditya

Differential Revision: https://reviews.llvm.org/D54022

llvm-svn: 345954

5 years ago[clangd] Really fix clang -Wimplicit-fallthrough
Fangrui Song [Fri, 2 Nov 2018 05:59:29 +0000 (05:59 +0000)]
[clangd] Really fix clang -Wimplicit-fallthrough

The intention was to fall through to Function case in LLVM_ENABLE_ASSERTIONS=Off builds.

Use #ifndef NDEBUG to fix -Wimplicit-fallthrough

llvm-svn: 345953

5 years ago[clangd] Fix clang -Wimplicit-fallthrough
Fangrui Song [Fri, 2 Nov 2018 04:23:50 +0000 (04:23 +0000)]
[clangd] Fix clang -Wimplicit-fallthrough

llvm-svn: 345952

5 years agoFix -Wimplicit-fallthrough warning in LLVM_ENABLE_ASSERTIONS=Off builds
Fangrui Song [Fri, 2 Nov 2018 04:17:17 +0000 (04:17 +0000)]
Fix -Wimplicit-fallthrough warning in LLVM_ENABLE_ASSERTIONS=Off builds

llvm-svn: 345951

5 years agoFix -Wimplicit-fallthrough warning in LLVM_ENABLE_ASSERTIONS=Off builds
Fangrui Song [Fri, 2 Nov 2018 04:09:08 +0000 (04:09 +0000)]
Fix -Wimplicit-fallthrough warning in LLVM_ENABLE_ASSERTIONS=Off builds

llvm-svn: 345950

5 years agoAMDGPU: Fix assertion with bitcast from i64 constant to v4i16
Matt Arsenault [Fri, 2 Nov 2018 02:43:55 +0000 (02:43 +0000)]
AMDGPU: Fix assertion with bitcast from i64 constant to v4i16

llvm-svn: 345922

5 years agotest/DebugInfo: Convert some tests to MIR
Matthias Braun [Fri, 2 Nov 2018 01:31:52 +0000 (01:31 +0000)]
test/DebugInfo: Convert some tests to MIR

These tests are meant to test dwarf emission (or prolog/epilogue
generation) so we can convert them to .mir and only run the relevant
part of the pipeline.
This way they become independent of changes in earlier passes such as my
planned changes to RegAllocFast.

llvm-svn: 345919

5 years agoLLVMTargetMachine/TargetPassConfig: Simplify handling of start/stop options; NFC
Matthias Braun [Fri, 2 Nov 2018 01:31:50 +0000 (01:31 +0000)]
LLVMTargetMachine/TargetPassConfig: Simplify handling of start/stop options; NFC

- Make some TargetPassConfig methods that just check whether options have
  been set static.
- Shuffle code in LLVMTargetMachine around so addPassesToGenerateCode
  only deals with TargetPassConfig now (but not with MCContext or the
  creation of MachineModuleInfo)

llvm-svn: 345918

5 years ago[WebAssembly] Added a .globaltype directive to .s output.
Wouter van Oortmerssen [Fri, 2 Nov 2018 00:45:00 +0000 (00:45 +0000)]
[WebAssembly] Added a .globaltype directive to .s output.

Summary:
Assembly output can use globals like __stack_pointer implicitly,
but has no way of indicating the type of such a global, which makes
it hard for tools processing it (such as the MC Assembler) to
reconstruct this information.

The improved assembler directives parsing (in progress in
https://reviews.llvm.org/D53842) will make use of this information.

Also deleted code for the .import_global directive which was unused.

New test case in userstack.ll

Reviewers: dschuff, sbc100

Subscribers: jgravelle-google, aheejin, sunfish, llvm-commits

Differential Revision: https://reviews.llvm.org/D54012

llvm-svn: 345917

5 years ago[WebAssembly] General vector shift lowering
Thomas Lively [Fri, 2 Nov 2018 00:39:57 +0000 (00:39 +0000)]
[WebAssembly] General vector shift lowering

Summary: Adds support for lowering non-splat shifts.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

Differential Revision: https://reviews.llvm.org/D53625

llvm-svn: 345916

5 years agoWhen building a header module, treat inputs as headers rather than
Richard Smith [Fri, 2 Nov 2018 00:24:40 +0000 (00:24 +0000)]
When building a header module, treat inputs as headers rather than
source files.

This suppresses certain warnings (eg, '#include_next in main source
file').

llvm-svn: 345915

5 years ago[NFC][LICM] Factor out instruction erasing logic
Max Kazantsev [Fri, 2 Nov 2018 00:21:45 +0000 (00:21 +0000)]
[NFC][LICM] Factor out instruction erasing logic

This patch factors out a function that makes all required updates
whenever an instruction gets erased.

Differential Revision: https://reviews.llvm.org/D54011
Reviewed By: apilipenko

llvm-svn: 345914

5 years ago[WebAssembly] Expand inserts and extracts with variable indices
Thomas Lively [Fri, 2 Nov 2018 00:06:56 +0000 (00:06 +0000)]
[WebAssembly] Expand inserts and extracts with variable indices

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

Differential Revision: https://reviews.llvm.org/D53964

llvm-svn: 345913

5 years agoWhen no FileCheck binary is specified, look in the llvm/clang bin
Jason Molenda [Thu, 1 Nov 2018 23:41:05 +0000 (23:41 +0000)]
When no FileCheck binary is specified, look in the llvm/clang bin
dirs relative to the source directory (Xcode build style) to find
one, use it if found.

llvm-svn: 345912

5 years ago[AliasSetTracker] Misc cleanup (NFCI)
Alina Sbirlea [Thu, 1 Nov 2018 23:37:51 +0000 (23:37 +0000)]
[AliasSetTracker] Misc cleanup (NFCI)

Summary: Remove two redundant checks, add one in the unit test. Remove an unused method. Fix computation of TotalMayAliasSetSize.
llvm-svn: 345911

5 years ago[gold-plugin] Fix a bunch of build warnings
Mandeep Singh Grang [Thu, 1 Nov 2018 23:34:12 +0000 (23:34 +0000)]
[gold-plugin] Fix a bunch of build warnings

Phabricator: https://reviews.llvm.org/D53997
llvm-svn: 345910

5 years ago[COFF, ARM64] Implement Intrinsic.sponentry for AArch64
Mandeep Singh Grang [Thu, 1 Nov 2018 23:22:25 +0000 (23:22 +0000)]
[COFF, ARM64] Implement Intrinsic.sponentry for AArch64

Summary: This patch adds Intrinsic.sponentry. This intrinsic is required to correctly support setjmp for AArch64 Windows platform.

Patch by: Yin Ma (yinma@codeaurora.org)

Reviewers: mgrang, ssijaric, eli.friedman, TomTan, mstorsjo, rnk, compnerd, efriedma

Reviewed By: efriedma

Subscribers: efriedma, javed.absar, kristof.beyls, chrib, llvm-commits

Differential Revision: https://reviews.llvm.org/D53996

llvm-svn: 345909

5 years ago[DAGCombiner] Make the isTruncateOf call from visitZERO_EXTEND work for vectors....
Craig Topper [Thu, 1 Nov 2018 23:21:45 +0000 (23:21 +0000)]
[DAGCombiner] Make the isTruncateOf call from visitZERO_EXTEND work for vectors. Remove FIXME.

I'm having trouble creating a test case for the ISD::TRUNCATE part of this that shows any codegen differences. But I was able to test the setcc path which is what the test changes here cover.

llvm-svn: 345908

5 years ago[X86] Add test cases for adding vector support to isTruncateOf in DAGCombiner::visitZ...
Craig Topper [Thu, 1 Nov 2018 23:21:42 +0000 (23:21 +0000)]
[X86] Add test cases for adding vector support to isTruncateOf in DAGCombiner::visitZERO_EXTEND

llvm-svn: 345907

5 years ago[MachineOutliner][NFC] Remember when you map something illegal across MBBs
Jessica Paquette [Thu, 1 Nov 2018 23:09:06 +0000 (23:09 +0000)]
[MachineOutliner][NFC] Remember when you map something illegal across MBBs

Instruction mapping in the outliner uses "illegal numbers" to signify that
something can't ever be part of an outlining candidate. This means that the
number is unique and can't be part of any repeated substring.

Because each of these is unique, we can use a single unique number to represent
a range of things we can't outline.

The outliner tries to leverage this using a flag which is set in an MBB when
the previous instruction we tried to map was "illegal". This patch improves
that logic to work across MBBs. As a bonus, this also simplifies the mapping
logic somewhat.

This also updates the machine-outliner-remarks test, which was impacted by the
order of Candidates on an OutlinedFunction changing. This order isn't
guaranteed, so I added a FIXME to fix that in a follow-up. The order of
Candidates on an OutlinedFunction isn't important, so this still is NFC.

llvm-svn: 345906

5 years ago[XRay] Fix TSC and atomic custom/typed event accounting
Dean Michael Berris [Thu, 1 Nov 2018 22:57:50 +0000 (22:57 +0000)]
[XRay] Fix TSC and atomic custom/typed event accounting

Summary:
This is a follow-on change to D53858 which turns out to have had a TSC
accounting bug when writing out function exit records in FDR mode.

This change adds a number of tests to ensure that:

- We are handling the delta between the exit TSC and the last TSC we've
  seen.

- We are writing the custom event and typed event records as a single
  update to the buffer extents.

- We are able to catch boundary conditions when loading FDR logs.

We introduce a TSC matcher to the test helpers, which we use in the
testing/verification of the TSC accounting change.

Reviewers: mboerger

Subscribers: mgorny, hiraditya, jfb, llvm-commits

Differential Revision: https://reviews.llvm.org/D53967

llvm-svn: 345905

5 years ago[IR] remove fake binop query for fneg
Sanjay Patel [Thu, 1 Nov 2018 22:56:15 +0000 (22:56 +0000)]
[IR] remove fake binop query for fneg

We want to remove this fneg API because it would silently fail
if we add an actual fneg instruction to IR (as proposed in
D53877 ).

We have a newer 'match' API that makes checking for
these patterns simpler. It also works with vectors
that may include undef elements in constants.

If any out-of-tree users need updating, they can model
their code changes on this commit:
https://reviews.llvm.org/rL345295

llvm-svn: 345904

5 years ago[CodeGen] Fix assertion on referencing constexpr Obj-C object with ARC.
Volodymyr Sapsai [Thu, 1 Nov 2018 22:50:08 +0000 (22:50 +0000)]
[CodeGen] Fix assertion on referencing constexpr Obj-C object with ARC.

Failed assertion is
> Assertion failed: ((ND->isUsed(false) || !isa<VarDecl>(ND) || !E->getLocation().isValid()) && "Should not use decl without marking it used!"), function EmitDeclRefLValue, file llvm-project/clang/lib/CodeGen/CGExpr.cpp, line 2437.

`EmitDeclRefLValue` mentions
> // A DeclRefExpr for a reference initialized by a constant expression can
> // appear without being odr-used. Directly emit the constant initializer.

The fix is to use the similar approach for non-references as for references. It
is achieved by trying to emit a constant before we attempt to load non-odr-used
variable as LValue.

rdar://problem/40650504

Reviewers: ahatanak, rjmccall

Reviewed By: rjmccall

Subscribers: dexonsmith, erik.pilkington, cfe-commits

Differential Revision: https://reviews.llvm.org/D53674

llvm-svn: 345903

5 years ago[AMDGPU] Handle the idot8 pattern generated by FE.
Farhana Aleen [Thu, 1 Nov 2018 22:48:19 +0000 (22:48 +0000)]
[AMDGPU] Handle the idot8 pattern generated by FE.

Summary: Different variants of idot8 codegen dag patterns are not generated by llvm-tablegen due to a huge
         increase in the compile time. Support the pattern that clang FE generates after reordering the
         additions in integer-dot8 source language pattern.

Author: FarhanaAleen

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D53937

llvm-svn: 345902

5 years ago[File] Remove static method to get permissions.
Jonas Devlieghere [Thu, 1 Nov 2018 22:46:49 +0000 (22:46 +0000)]
[File] Remove static method to get permissions.

This patch removes the static accessor in File to get a file's
permissions. Permissions should be checked through the FileSystem class.

llvm-svn: 345901

5 years agoFix test assumption that Linux implies glibc.
Dan Albert [Thu, 1 Nov 2018 22:35:51 +0000 (22:35 +0000)]
Fix test assumption that Linux implies glibc.

Summary:
This fixes an regression when using bionic introduced in r345173.

I need to follow up and figure out what exactly is implied by
TEST_HAS_C11_FEATURES and see what the correct configuration is for
bionic (new versions should have everything the tests care about,
versions that predate C11 certainly don't), but this gets the tests
back to the old behavior.

Reviewers: EricWF

Reviewed By: EricWF

Subscribers: mclow.lists, christof, ldionne, libcxx-commits, cfe-commits

Differential Revision: https://reviews.llvm.org/D53956

llvm-svn: 345900

5 years ago[ELF] Change sh_link of .rel{,a}.plt to make GNU strip happy
Fangrui Song [Thu, 1 Nov 2018 22:28:58 +0000 (22:28 +0000)]
[ELF] Change sh_link of .rel{,a}.plt to make GNU strip happy

Summary:
D52830 sets sh_link to .symtab in static link, which breaks executable stripped by GNU strip.
It may also be odd that .rela.plt (SHF_ALLOC) points to .symtab (non-SHF_ALLOC).

Change the logic on pcc's suggestion.

Before:

% clang -fuse-ld=lld -static -xc =(printf 'int main(){}') # or gcc
% strip a.out; ./a.out
unexpected reloc type in static binary[1]    61634 segmentation fault  ./a.out

Reviewers: ruiu, grimar, emaste, espindola

Reviewed By: ruiu

Subscribers: pcc, arichardson, llvm-commits

Differential Revision: https://reviews.llvm.org/D53993

llvm-svn: 345899

5 years ago[FileSystem] Update SetFile signature.
Jonas Devlieghere [Thu, 1 Nov 2018 22:16:34 +0000 (22:16 +0000)]
[FileSystem] Update SetFile signature.

llvm-svn: 345898

5 years ago[CodeGen] Move `emitConstant` from ScalarExprEmitter to CodeGenFunction. NFC.
Volodymyr Sapsai [Thu, 1 Nov 2018 21:57:05 +0000 (21:57 +0000)]
[CodeGen] Move `emitConstant` from ScalarExprEmitter to CodeGenFunction. NFC.

The goal is to use `emitConstant` in more places. Didn't move
`ComplexExprEmitter::emitConstant` because it returns a different type.

Reviewers: rjmccall, ahatanak

Reviewed By: rjmccall

Subscribers: dexonsmith, erik.pilkington, cfe-commits

Differential Revision: https://reviews.llvm.org/D53725

llvm-svn: 345897

5 years ago[llvm-objcopy/strip] [NFC] Clean up tablegen opts (clang-format + reorganizing things).
Jordan Rupprecht [Thu, 1 Nov 2018 21:38:14 +0000 (21:38 +0000)]
[llvm-objcopy/strip] [NFC] Clean up tablegen opts (clang-format + reorganizing things).

llvm-svn: 345896

5 years ago[FileSystem] Change FileSpec constructor signature (2/2)
Jonas Devlieghere [Thu, 1 Nov 2018 21:26:58 +0000 (21:26 +0000)]
[FileSystem] Change FileSpec constructor signature (2/2)

Fix breakage due to the recent FileSpec change that extracts the path
resultion logic into FileSystem for the FreeBSD host.

llvm-svn: 345895

5 years agoSilence -Wimplicit-fallthrough in gold plugin
Reid Kleckner [Thu, 1 Nov 2018 21:24:33 +0000 (21:24 +0000)]
Silence -Wimplicit-fallthrough in gold plugin

Fatal errors are likely fatal, but in case they aren't, return instead
of printing a second warning.

llvm-svn: 345894

5 years agoRevert "Bug 39129: Speeding up partition_point/lower_bound/upper_bound/ by using...
Louis Dionne [Thu, 1 Nov 2018 21:24:32 +0000 (21:24 +0000)]
Revert "Bug 39129: Speeding up partition_point/lower_bound/upper_bound/ by using unsigned division by 2 when possible."

This reverts r345525. I'm reverting because that patch apparently caused
a regression on certain platforms (see https://reviews.llvm.org/D53994).
Since we don't fully understand the reasons for the regression, I'm
reverting until we can provide a fix we understand.

llvm-svn: 345893

5 years ago[COFF, ARM64] Implement llvm.addressofreturnaddress intrinsic
Mandeep Singh Grang [Thu, 1 Nov 2018 21:23:47 +0000 (21:23 +0000)]
[COFF, ARM64] Implement llvm.addressofreturnaddress intrinsic

Reviewers: rnk, mstorsjo, efriedma, TomTan

Reviewed By: efriedma

Subscribers: javed.absar, kristof.beyls, chrib, llvm-commits

Differential Revision: https://reviews.llvm.org/D53962

llvm-svn: 345892

5 years ago[FileSystem] Change FileSpec constructor signature.
Jonas Devlieghere [Thu, 1 Nov 2018 21:18:25 +0000 (21:18 +0000)]
[FileSystem] Change FileSpec constructor signature.

Fix breakage due to the recent FileSpec change that extracts the path
resultion logic into FileSystem for the Android host.

llvm-svn: 345891

5 years ago[FileSystem] Move path resolution logic out of FileSpec
Jonas Devlieghere [Thu, 1 Nov 2018 21:05:36 +0000 (21:05 +0000)]
[FileSystem] Move path resolution logic out of FileSpec

This patch removes the logic for resolving paths out of FileSpec and
updates call sites to rely on the FileSystem class instead.

Differential revision: https://reviews.llvm.org/D53915

llvm-svn: 345890

5 years ago[CMake][Fuchsia] Don't restrict Linux runtimes to UNIX
Petr Hosek [Thu, 1 Nov 2018 20:36:33 +0000 (20:36 +0000)]
[CMake][Fuchsia] Don't restrict Linux runtimes to UNIX

This allows building Linux runtimes on any platform if the correct
sysroot is provided via CMake option.

Differential Revision: https://reviews.llvm.org/D53970

llvm-svn: 345889

5 years ago[WebAssembly] Fix signature parsing for 'try' in AsmParser
Heejin Ahn [Thu, 1 Nov 2018 20:32:15 +0000 (20:32 +0000)]
[WebAssembly] Fix signature parsing for 'try' in AsmParser

Summary:
Like `block` or `loop`, `try` can take an optional signature which can
be omitted. This patch allows `try`'s signature to be omitted. Also
added some tests for EH instructions.

Reviewers: aardappel

Subscribers: dschuff, sbc100, jgravelle-google, sunfish, llvm-commits

Differential Revision: https://reviews.llvm.org/D53873

llvm-svn: 345888

5 years agoEnable -Wimplicit-fallthrough for clang as well as GCC
Reid Kleckner [Thu, 1 Nov 2018 20:31:44 +0000 (20:31 +0000)]
Enable -Wimplicit-fallthrough for clang as well as GCC

All instances of this warning should already be fixed across all LLVM
subprojects, at least on Linux.

llvm-svn: 345887

5 years agoOmit "virtual" if overridden.
Rui Ueyama [Thu, 1 Nov 2018 20:08:39 +0000 (20:08 +0000)]
Omit "virtual" if overridden.

llvm-svn: 345886

5 years agoUse llvm_unreachable for unreachable code.
Rui Ueyama [Thu, 1 Nov 2018 20:08:29 +0000 (20:08 +0000)]
Use llvm_unreachable for unreachable code.

llvm-svn: 345885

5 years agoSet MAttrs in LTO mode
Fangrui Song [Thu, 1 Nov 2018 20:02:49 +0000 (20:02 +0000)]
Set MAttrs in LTO mode

Summary: Without this patch, MAttrs are not set.

Patch by Yin Ma

Reviewers: espindola, MaskRay, ruiu, pcc

Reviewed By: MaskRay, pcc

Subscribers: pcc, emaste, sbc100, inglorion, arichardson, aheejin, steven_wu, llvm-commits

Differential Revision: https://reviews.llvm.org/D53446

llvm-svn: 345884

5 years ago[Hexagon] Remove unintended fallthrough from MC duplex code
Reid Kleckner [Thu, 1 Nov 2018 19:59:27 +0000 (19:59 +0000)]
[Hexagon] Remove unintended fallthrough from MC duplex code

I added these annotations in r345878 because I wasn't sure if the
fallthrough was intended. Krzysztof Parzyszek confirmed that they should
be breaks, so that's what this patch does.

Reviewers: kparzysz

Differential Revision: https://reviews.llvm.org/D53991

llvm-svn: 345883

5 years agoFix clang -Wimplicit-fallthrough warnings across llvm, NFC
Reid Kleckner [Thu, 1 Nov 2018 19:54:45 +0000 (19:54 +0000)]
Fix clang -Wimplicit-fallthrough warnings across llvm, NFC

This patch should not introduce any behavior changes. It consists of
mostly one of two changes:
1. Replacing fall through comments with the LLVM_FALLTHROUGH macro
2. Inserting 'break' before falling through into a case block consisting
   of only 'break'.

We were already using this warning with GCC, but its warning behaves
slightly differently. In this patch, the following differences are
relevant:
1. GCC recognizes comments that say "fall through" as annotations, clang
   doesn't
2. GCC doesn't warn on "case N: foo(); default: break;", clang does
3. GCC doesn't warn when the case contains a switch, but falls through
   the outer case.

I will enable the warning separately in a follow-up patch so that it can
be cleanly reverted if necessary.

Reviewers: alexfh, rsmith, lattner, rtrieu, EricWF, bollu

Differential Revision: https://reviews.llvm.org/D53950

llvm-svn: 345882

5 years ago[LoopInterchange] Fix unused variables in release build
Florian Hahn [Thu, 1 Nov 2018 19:51:13 +0000 (19:51 +0000)]
[LoopInterchange] Fix unused variables in release build

llvm-svn: 345881

5 years ago[WebAssembly] Fixup `main` signature by default
Sam Clegg [Thu, 1 Nov 2018 19:38:44 +0000 (19:38 +0000)]
[WebAssembly] Fixup `main` signature by default

Differential Revision: https://reviews.llvm.org/D53396

llvm-svn: 345880

5 years ago[codeview] Add breaks to fix -Wimplicit-fallthrough
Reid Kleckner [Thu, 1 Nov 2018 19:36:29 +0000 (19:36 +0000)]
[codeview] Add breaks to fix -Wimplicit-fallthrough

This is a minor bug fix. Previously, if you tried to encode the RSP
register on the x86 platform, that might have succeeded and been encoded
incorrectly. However, no existing producer or consumer passes the x86_64
registers when targeting x86_32.

llvm-svn: 345879

5 years agoAnnotate possibly unintended fallthroughs in Hexagon MC code, NFC
Reid Kleckner [Thu, 1 Nov 2018 19:32:04 +0000 (19:32 +0000)]
Annotate possibly unintended fallthroughs in Hexagon MC code, NFC

Clang's -Wimplicit-fallthrough check fires on these switch cases. GCC
does not warn when a case body that ends in a switch falls through to a
case label of an outer switch.

It's not clear if these fall throughs are truly intended.  The Hexagon
tests pass regardless of whether these case blocks fall through or
break.

For now, I have applied the intended fallthrough annotation macro with a
FIXME comment to unblock enabling the warning. I will send a follow-up
patch that converts them to breaks to the Hexagon maintainers.

llvm-svn: 345878

5 years ago[LoopInterchange] Remove support for inner-only reductions.
Florian Hahn [Thu, 1 Nov 2018 19:25:00 +0000 (19:25 +0000)]
[LoopInterchange] Remove support for inner-only reductions.

Inner-loop only reductions require additional checks to make sure they
form a load-phi-store cycle across inner and outer loop. Otherwise the
reduction value is not properly preserved. This patch disables
interchanging such loops for now, as it causes miscompiles in some
cases and it seems to apply only for a tiny amount of loops. Across the
test-suite, SPEC2000 and SPEC2006, 61 instead of 62 loops are
interchange with inner loop reduction support disabled. With
-loop-interchange-threshold=-1000, 3256 instead of 3267.

See the discussion and history of D53027 for an outline of how such legality
checks could look like.

Reviewers: efriedma, mcrosier, davide

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D53027

llvm-svn: 345877

5 years agoRemove unnecessary fallthrough annotation after unreachable
Reid Kleckner [Thu, 1 Nov 2018 19:11:05 +0000 (19:11 +0000)]
Remove unnecessary fallthrough annotation after unreachable

Clang's -Wimplicit-fallthrough implementation warns on this. I built
clang with GCC 7.3 in +asserts and -asserts mode, and GCC doesn't warn
on this in either configuration. I think it is unnecessary. I separated
it from the large mechanical patch (https://reviews.llvm.org/D53950) in
case I am wrong and it has to be reverted.

llvm-svn: 345876

5 years ago[GlobalISel] Fix a bug in LegalizeRuleSet::clampMaxNumElements
Volkan Keles [Thu, 1 Nov 2018 19:01:53 +0000 (19:01 +0000)]
[GlobalISel] Fix a bug in LegalizeRuleSet::clampMaxNumElements

Summary:
This function was causing a crash when `MaxElements == 1` because
it was trying to create a single element vector type.

Reviewers: dsanders, aemerson, aditya_nandakumar

Reviewed By: dsanders

Subscribers: rovka, kristof.beyls, javed.absar, llvm-commits

Differential Revision: https://reviews.llvm.org/D53734

llvm-svn: 345875

5 years agoOutput "rule" information in SARIF exports.
Aaron Ballman [Thu, 1 Nov 2018 18:57:38 +0000 (18:57 +0000)]
Output "rule" information in SARIF exports.

SARIF allows you to export descriptions about rules that are present in the SARIF log. Expose the help text table generated into Checkers.inc as the rule's "full description" and export all of the rules present in the analysis output. This information is useful for analysis result viewers like CodeSonar.

llvm-svn: 345874

5 years agoAdd LLVM_FALLTHROUGH annotation after switch
Reid Kleckner [Thu, 1 Nov 2018 18:53:02 +0000 (18:53 +0000)]
Add LLVM_FALLTHROUGH annotation after switch

This silences a -Wimplicit-fallthrough warning from clang. GCC does not
appear to warn when the case body ends in a switch.

This is a somewhat surprising but intended fallthrough that I pulled out
from my mechanical patch. The code intends to handle 'Yi' and related
constraints as the 'x' constraint.

llvm-svn: 345873

5 years agoRevert "[COFF, ARM64] Change setjmp for AArch64 Windows to use Intrinsic.sponentry"
Mandeep Singh Grang [Thu, 1 Nov 2018 18:38:26 +0000 (18:38 +0000)]
Revert "[COFF, ARM64] Change setjmp for AArch64 Windows to use Intrinsic.sponentry"

This reverts commit 619111f5ccf349b635e4987ec02d15777c571495.

llvm-svn: 345872

5 years agoRevert "Reapply Logging: make os_log buffer size an integer constant expression."
Tim Northover [Thu, 1 Nov 2018 18:37:42 +0000 (18:37 +0000)]
Revert "Reapply Logging: make os_log buffer size an integer constant expression."

Still more dependency hell.

llvm-svn: 345871

5 years agoUse C++11 fallthrough attribute syntax when available and add a break
Reid Kleckner [Thu, 1 Nov 2018 18:24:03 +0000 (18:24 +0000)]
Use C++11 fallthrough attribute syntax when available and add a break

Summary:
This silences the two -Wimplicit-fallthrough warnings clang finds in
ItaniumDemangle.h in libc++abi.

Clang does not have a GNU attribute spelling for this attribute, so this
is necessary.

I will commit the same change to the LLVM demangler soon.

Reviewers: EricWF, ldionne

Subscribers: christof, erik.pilkington, cfe-commits

Differential Revision: https://reviews.llvm.org/D53985

llvm-svn: 345870

5 years ago[LegalizeDAG] Add generic vector CTPOP expansion (PR32655)
Simon Pilgrim [Thu, 1 Nov 2018 18:22:11 +0000 (18:22 +0000)]
[LegalizeDAG] Add generic vector CTPOP expansion (PR32655)

This patch adds support for expanding vector CTPOP instructions and removes the x86 'bitmath' lowering which replicates the same expansion.

Differential Revision: https://reviews.llvm.org/D53258

llvm-svn: 345869

5 years ago[Hexagon] Fix MO_JumpTable const extender conversion
Reid Kleckner [Thu, 1 Nov 2018 18:14:45 +0000 (18:14 +0000)]
[Hexagon] Fix MO_JumpTable const extender conversion

Previously this case fell through to unreachable, so it is clearly not
covered by any test case in LLVM. It may be dynamically unreachable, in
fact. However, if it were to run, this is what it would logically do.
The assert suggests that the intended behavior was not to allow folding
offsets from jump table indices, which makes sense.

llvm-svn: 345868

5 years ago[OpenMP][libomptarget] Add runtime function for pushing coalesced global records
Gheorghe-Teodor Bercea [Thu, 1 Nov 2018 18:08:12 +0000 (18:08 +0000)]
[OpenMP][libomptarget] Add runtime function for pushing coalesced global records

Summary: In the case of coalesced global records, we need to push the exact data size passed in. This patch fixes this by outlining the common functionality of the previous push function and by adding a separate entry point for coalesced pushes. The pop function remains unchanged.

Reviewers: ABataev, grokos, caomhin

Reviewed By: ABataev, grokos

Subscribers: jholewinski, cfe-commits, Hahnfeld, guansong, jfb, openmp-commits

Differential Revision: https://reviews.llvm.org/D53141

llvm-svn: 345867

5 years agoReapply Logging: make os_log buffer size an integer constant expression.
Tim Northover [Thu, 1 Nov 2018 18:04:49 +0000 (18:04 +0000)]
Reapply Logging: make os_log buffer size an integer constant expression.

The size of an os_log buffer is known at any stage of compilation, so making it
a constant expression means that the common idiom of declaring a buffer for it
won't result in a VLA. That allows the compiler to skip saving and restoring
the stack pointer around such buffers.

This also moves the OSLog helpers from libclangAnalysis to libclangAST
to avoid a circular dependency.

llvm-svn: 345866