Artem Dergachev [Wed, 29 Aug 2018 21:50:52 +0000 (21:50 +0000)]
[CFG] [analyzer] Disable argument construction contexts for variadic functions.
The analyzer doesn't make use of them anyway and they seem to have
pretty weird AST from time to time, so let's just skip them for now.
Fixes pr37769.
Differential Revision: https://reviews.llvm.org/D50824
llvm-svn: 340975
Philip Reames [Wed, 29 Aug 2018 21:49:30 +0000 (21:49 +0000)]
[LICM] Hoist stores of invariant values to invariant addresses out of loops
Teach LICM to hoist stores out of loops when the store writes to a location otherwise unused in the loop, writes a value which is invariant, and is guaranteed to execute if the loop is entered.
Worth noting is that this transformation is partially overlapping with the existing promotion transformation. Reasons this is worthwhile anyway include:
* For multi-exit loops, this doesn't require duplication of the store.
* It kicks in for case where we can't prove we exit through a normal exit (i.e. we may throw), but can prove the store executes before that possible side exit.
Differential Revision: https://reviews.llvm.org/D50925
llvm-svn: 340974
Kostya Serebryany [Wed, 29 Aug 2018 21:28:14 +0000 (21:28 +0000)]
[hwasan] simplify the realloc implementation: always allocate/deallocate on realloc. This may slowdown some realloc-heavy code, but at least at this point a want simpler code. Also added a test
llvm-svn: 340973
George Karpenkov [Wed, 29 Aug 2018 21:18:47 +0000 (21:18 +0000)]
[analyzer] Fix tests on 32-bit platforms by specifying the tuple explicitly
llvm-svn: 340972
Kostya Serebryany [Wed, 29 Aug 2018 21:07:07 +0000 (21:07 +0000)]
Add a thread-local ring buffer of heap allocations
Summary:
We need this in order to properly report heap-use-after-free,
since we don't have a quarantine.
This is a first part of the code, more like a proof of concept.
But I'd like to commit at as is and proceed with refactoring,
adding a ThreadRegistry, and extending the functionality.
Reviewers: eugenis
Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D51394
llvm-svn: 340971
Heejin Ahn [Wed, 29 Aug 2018 21:03:16 +0000 (21:03 +0000)]
[WebAssembly] clang-format (NFC)
Summary: This patch runs clang-format on all wasm-only files.
Reviewers: sbc100
Subscribers: dschuff, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D51449
llvm-svn: 340970
Kostya Serebryany [Wed, 29 Aug 2018 21:00:01 +0000 (21:00 +0000)]
[sanitizer] reapply r340884 'Add a RingBuffer class to sanitizer_common', with fixes for Windows
llvm-svn: 340969
Alexey Bataev [Wed, 29 Aug 2018 20:41:37 +0000 (20:41 +0000)]
[OPENMP] Do not create offloading entry for declare target variables
declarations.
We should not create offloading entries for declare target var
declarations as it causes compiler crash.
llvm-svn: 340968
Yaxun Liu [Wed, 29 Aug 2018 20:39:22 +0000 (20:39 +0000)]
Add predefined macro __gnu_linux__ for proper aux-triple
Clang predefine macro __linx__ for aux-triple with Linux OS
but does not predefine macro __gnu_linux__. This causes
some compilation error for certain applications, e.g. Eigen.
This patch fixes that.
Differential Revision: https://reviews.llvm.org/D51441
llvm-svn: 340967
Greg Clayton [Wed, 29 Aug 2018 20:34:08 +0000 (20:34 +0000)]
Don't include the Age in the UUID for CvRecordPdb70 UUID records in minidump files for Apple vendors.
The CvRecordPdb70 structure looks like:
struct CvRecordPdb70 {
uint8_t Uuid[16];
llvm::support::ulittle32_t Age;
// char PDBFileName[];
};
We were including the "Age" in the UUID for Apple vedors which caused us to not be able to match the UUID to built binaries. The "Age" field is set to zero in breakpad minidump files for Apple targets.
Differential Revision: https://reviews.llvm.org/D51442
llvm-svn: 340966
George Karpenkov [Wed, 29 Aug 2018 20:29:59 +0000 (20:29 +0000)]
[analyzer] Resolve the crash in ReturnUndefChecker
By making sure the returned value from getKnownSVal is consistent with
the value used inside expression engine.
PR38427
Differential Revision: https://reviews.llvm.org/D51252
llvm-svn: 340965
George Karpenkov [Wed, 29 Aug 2018 20:29:39 +0000 (20:29 +0000)]
[analyzer] [NFC] Move class definition out of the function
Differential Revision: https://reviews.llvm.org/D51322
llvm-svn: 340964
George Karpenkov [Wed, 29 Aug 2018 20:29:17 +0000 (20:29 +0000)]
[analyzer] Move analyzer-eagerly-assume to AnalyzerOptions, enable by default
Differential Revision: https://reviews.llvm.org/D51251
llvm-svn: 340963
George Karpenkov [Wed, 29 Aug 2018 20:28:54 +0000 (20:28 +0000)]
[analyzer] [NFC] Remove unused "state" argument from makeSymExprValNN
Differential Revision: https://reviews.llvm.org/D51250
llvm-svn: 340962
George Karpenkov [Wed, 29 Aug 2018 20:28:33 +0000 (20:28 +0000)]
[analyzer] Better retain count rules for OSObjects
Differential Revision: https://reviews.llvm.org/D51184
llvm-svn: 340961
George Karpenkov [Wed, 29 Aug 2018 20:28:13 +0000 (20:28 +0000)]
[analyzer] [NFC] Follow the convention when naming classes
Renames InvalidateRegionsWorker and RemoveDeadBindingsWorker
Differential Revision: https://reviews.llvm.org/D51324
llvm-svn: 340960
Marek Olsak [Wed, 29 Aug 2018 20:03:00 +0000 (20:03 +0000)]
AMDGPU: Handle 32-bit address wraparounds for SMRD opcodes
Summary: This fixes GPU hangs with OpenGL bindless handle arithmetic.
Reviewers: arsenm, nhaehnle
Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D51203
llvm-svn: 340959
Raphael Isemann [Wed, 29 Aug 2018 19:55:33 +0000 (19:55 +0000)]
Removed commented out includes [NFC]
llvm-svn: 340958
Kostya Kortchinsky [Wed, 29 Aug 2018 19:41:28 +0000 (19:41 +0000)]
[sanitizer] Revert D50940
Summary:
The previous version of the patch makes some code unable to distinguish
failure to map address 0 and error.
Revert to turn the bots back to green while figuring out a new approach.
Reviewers: eugenis
Reviewed By: eugenis
Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D51451
llvm-svn: 340957
Alexey Bataev [Wed, 29 Aug 2018 19:22:06 +0000 (19:22 +0000)]
[OPENMP][NVPTX] Replace assert() by ASSERT0() macro, NFC.
Required to fix the buildbots.
llvm-svn: 340956
Fedor Sergeev [Wed, 29 Aug 2018 19:10:44 +0000 (19:10 +0000)]
[SimpleLoopUnswitch] After unswitch delete dead blocks in parent loops
Summary:
Assert from PR38737 happens on the dead block inside the parent loop
after unswitching nontrivial switch in the inner loop.
deleteDeadBlocksFromLoop now takes extra care to detect/remove dead
blocks in all the parent loops in addition to the blocks from original
loop being unswitched.
Reviewers: asbirlea, chandlerc
Reviewed By: asbirlea
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D51415
llvm-svn: 340955
Matt Morehouse [Wed, 29 Aug 2018 18:40:41 +0000 (18:40 +0000)]
Revert "[libFuzzer] Port to Windows"
This reverts r340949 due to bot breakage again.
llvm-svn: 340954
Alexey Bataev [Wed, 29 Aug 2018 18:32:21 +0000 (18:32 +0000)]
[OPENMP][NVPTX] Add support for lightweight runtime.
If the target construct can be executed in SPMD mode + it is a loop
based directive with static scheduling, we can use lightweight runtime
support.
llvm-svn: 340953
Sanjay Patel [Wed, 29 Aug 2018 18:27:49 +0000 (18:27 +0000)]
[InstCombine] canonicalize fneg with llvm.sin
This is a follow-up to rL339604 which did the same transform
for a sin libcall. The handling of intrinsics vs. libcalls
is unfortunately scattered, so I'm just adding this next to
the existing transform for llvm.cos for now.
This should resolve PR38458:
https://bugs.llvm.org/show_bug.cgi?id=38458
If the call was already negated, the negates will cancel
each other out.
llvm-svn: 340952
Alina Sbirlea [Wed, 29 Aug 2018 18:26:04 +0000 (18:26 +0000)]
[MemorySSA] Add expesive check for validating clobber accesses.
Summary: Add validation of clobber accesses as expensive check.
Reviewers: george.burgess.iv
Subscribers: sanjoy, jlebar, Prazek, llvm-commits
Differential Revision: https://reviews.llvm.org/D51327
llvm-svn: 340951
Sanjay Patel [Wed, 29 Aug 2018 18:11:42 +0000 (18:11 +0000)]
[InstCombine] add tests for llvm.sin(-x); NFC
Also add a corresponding test for llvm.cos with FMF to
make sure that was handled correctly.
llvm-svn: 340950
Matt Morehouse [Wed, 29 Aug 2018 18:08:34 +0000 (18:08 +0000)]
[libFuzzer] Port to Windows
Summary:
Port libFuzzer to windows-msvc.
This patch allows libFuzzer targets to be built and run on Windows, using -fsanitize=fuzzer and/or fsanitize=fuzzer-no-link. It allows these forms of coverage instrumentation to work on Windows as well.
It does not fix all issues, such as those with -fsanitize-coverage=stack-depth, which is not usable on Windows as of this patch.
It also does not fix any libFuzzer integration tests. Nearly all of them fail to compile, fixing them will come in a later patch, so libFuzzer tests are disabled on Windows until them.
Reviewers: morehouse, rnk
Reviewed By: morehouse, rnk
Subscribers: #sanitizers, delcypher, morehouse, kcc, eraman
Differential Revision: https://reviews.llvm.org/D51022
llvm-svn: 340949
Evandro Menezes [Wed, 29 Aug 2018 17:59:48 +0000 (17:59 +0000)]
[InstCombine] Expand the simplification of pow() with nested exp{,2}()
Expand the simplification of `pow(exp{,2}(x), y)` to all FP types.
This improvement helps some benchmarks in SPEC CPU2000 and CPU2006, such as
252.eon, 447.dealII, 453.povray. Otherwise, no significant regressions on
x86-64 or A64.
Differential revision: https://reviews.llvm.org/D51195
llvm-svn: 340948
Evandro Menezes [Wed, 29 Aug 2018 17:59:34 +0000 (17:59 +0000)]
[InstCombine] Expand the simplification of pow() into exp2()
Generalize the simplification of `pow(2.0, y)` to `pow(2.0 ** n, y)` for all
scalar and vector types.
This improvement helps some benchmarks in SPEC CPU2000 and CPU2006, such as
252.eon, 447.dealII, 453.povray. Otherwise, no significant regressions on
x86-64 or A64.
Differential revision: https://reviews.llvm.org/D49273
llvm-svn: 340947
Andrea Di Biagio [Wed, 29 Aug 2018 17:56:39 +0000 (17:56 +0000)]
[llvm-mca] Add fields "Total uOps" and "uOps Per Cycle" to the report generated by the SummaryView.
This patch adds two new fields to the perf report generated by the SummaryView.
Fields are now logically organized into two small groups; only the second group
contains throughput indicators.
Example:
```
Iterations: 100
Instructions: 300
Total Cycles: 414
Total uOps: 700
Dispatch Width: 4
uOps Per Cycle: 1.69
IPC: 0.72
Block RThroughput: 4.0
```
This patch also updates the docs for llvm-mca.
Due to the nature of this change, several tests in the tools/llvm-mca directory
were affected, and had to be updated using script `update_mca_test_checks.py`.
llvm-svn: 340946
Andrea Di Biagio [Wed, 29 Aug 2018 17:40:04 +0000 (17:40 +0000)]
[llvm-mca] Don't disable the SummaryView if flag `-all-stats` is false.
llvm-svn: 340945
Alexey Bataev [Wed, 29 Aug 2018 17:35:09 +0000 (17:35 +0000)]
[OPENMP][NVPTX] Lightweight runtime support for SPMD mode.
Summary:
Implemented simple and lightweight runtime support for SPMD mode-based
constructs. It adds support for L2 sequential parallelism wihtout full
runtime support. Also, patch fixes some use cases for
uninitialized|lightweight runtime.
Reviewers: grokos, kkwli0, Hahnfeld, gtbercea
Subscribers: guansong, openmp-commits
Differential Revision: https://reviews.llvm.org/D51222
llvm-svn: 340944
Martin Storsjo [Wed, 29 Aug 2018 17:30:45 +0000 (17:30 +0000)]
[CMake] Add an lld-test-depends target
This builds all dependencies of lld-test/check-lld, without running
the tests. This matches llvm-test-depends and clang-test-depends.
Differential Revision: https://reviews.llvm.org/D51439
llvm-svn: 340943
Martin Storsjo [Wed, 29 Aug 2018 17:28:34 +0000 (17:28 +0000)]
[MinGW] [X86] Add stubs for references to data variables that might end up imported from a dll
Variables declared with the dllimport attribute are accessed via a
stub variable named __imp_<var>. In MinGW configurations, variables that
aren't declared with a dllimport attribute might still end up imported
from another DLL with runtime pseudo relocs.
For x86_64, this avoids the risk that the target is out of range
for a 32 bit PC relative reference, in case the target DLL is loaded
further than 4 GB from the reference. It also avoids having to make the
text section writable at runtime when doing the runtime fixups, which
makes it worthwhile to do for i386 as well.
Add stub variables for all dso local data references where a definition
of the variable isn't visible within the module, since the DLL data
autoimporting might make them imported even though they are marked as
dso local within LLVM.
Don't do this for variables that actually are defined within the same
module, since we then know for sure that it actually is dso local.
Don't do this for references to functions, since there's no need for
runtime pseudo relocations for autoimporting them; if a function from
a different DLL is called without the appropriate dllimport attribute,
the call just gets routed via a thunk instead.
GCC does something similar since 4.9 (when compiling with -mcmodel=medium
or large; from that version, medium is the default code model for x86_64
mingw), but only for x86_64.
Differential Revision: https://reviews.llvm.org/D51288
llvm-svn: 340942
Martin Storsjo [Wed, 29 Aug 2018 17:26:58 +0000 (17:26 +0000)]
[MinGW] Don't mark external variables as DSO local
Since MinGW supports automatically importing external variables from
DLLs even without the DLLImport attribute, we shouldn't mark them
as DSO local unless we actually know them to be local for sure.
Keep marking thread local variables as DSO local.
Differential Revision: https://reviews.llvm.org/D51382
llvm-svn: 340941
Martin Storsjo [Wed, 29 Aug 2018 17:24:10 +0000 (17:24 +0000)]
[COFF] Merge the .ctors, .dtors and .CRT sections into .rdata for MinGW
There's no point in keeping them as separate sections.
This differs from GNU ld, which places .ctors and .dtors content in
.text (implemented by a built-in linker script). But since the content
only is pointers, there's no need to have it executable.
GNU ld also leaves .CRT separate as its own standalone section.
MSVC merges .CRT into .rdata similarly, with a directive embedded in
an object file in msvcrt.lib or libcmt.lib.
Differential Revision: https://reviews.llvm.org/D51414
llvm-svn: 340940
Craig Topper [Wed, 29 Aug 2018 17:09:21 +0000 (17:09 +0000)]
[InstCombine] Replace two calls to getNumUses() with !hasNUsesOrMore
We were calling getNumUses to check for 1 or 2 uses. But getNumUses is linear in the number of uses. We can instead use !hasNUsesOrMore(3) which will stop the linear scan as soon as it determines there are at least 3 uses even if there are more.
llvm-svn: 340939
Zachary Turner [Wed, 29 Aug 2018 16:57:37 +0000 (16:57 +0000)]
Update Visual Studio Integration version number.
This updates the version number in the manifest file to match
the SVN revision at which it was committed.
llvm-svn: 340938
Ilya Biryukov [Wed, 29 Aug 2018 16:35:31 +0000 (16:35 +0000)]
[Tooling] Do not restore working dir in ClangTool
Summary:
Resolve all relative paths before running the tool instead.
This fixes the usage of ClangTool in AllTUsExecutor. The executor will
try running multiple ClangTool instances in parallel with compile
commands that usually have the same working directory.
Changing working directory is a global operation, so we end up
changing working directory in the middle of running other actions,
which leads to spurious compile errors.
Reviewers: ioeric, sammccall
Reviewed By: ioeric
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D51407
llvm-svn: 340937
Farhana Aleen [Wed, 29 Aug 2018 16:31:18 +0000 (16:31 +0000)]
[AMDGPU] Match udot4 pattern.
Summary: D.u32 = S0.u8[0] * S1.u8[0] +
S0.u8[1] * S1.u8[1] +
S0.u8[2] * S1.u8[2] +
S0.u8[3] * S1.u8[3] + S2.u32
Author: FarhanaAleen
Reviewed By: arsenm
Subscribers: llvm-commits, AMDGPU
Differential Revision: https://reviews.llvm.org/D50921
llvm-svn: 340936
Alexandre Ganea [Wed, 29 Aug 2018 16:11:48 +0000 (16:11 +0000)]
[DebugCounters] Fix DebugCounterTest when running all SupportTests
Previously, the DebugCounterTest was failing because CommandLineTest.GetCommandLineArguments was clearing all the global singletons.
Differential Revision: https://reviews.llvm.org/D51423
llvm-svn: 340935
Mike Rice [Wed, 29 Aug 2018 15:45:11 +0000 (15:45 +0000)]
[OPENMP] Create non-const ident_t objects.
Currently ident_t objects are created const when debug info is not
enabled, but the libittnotify libray in the OpenMP runtime writes to
the reserved_2 field (See __kmp_itt_region_forking in
openmp/runtime/src/kmp_itt.inl). Now create ident_t objects non-const.
Differential Revision: https://reviews.llvm.org/D51331
llvm-svn: 340934
Sanjay Patel [Wed, 29 Aug 2018 15:34:19 +0000 (15:34 +0000)]
[InstCombine] add test for vector demanded elements + shrinking; NFC
llvm-svn: 340933
Simon Atanasyan [Wed, 29 Aug 2018 14:54:01 +0000 (14:54 +0000)]
[mips] Fix microMIPS unconditional branch offset handling
MipsSEInstrInfo class defines for internal purpose unconditional
branches as Mips::B nad Mips:J even in case of microMIPS code
generation. Under some conditions that leads to the bug - for rather long
branch which fits to Mips jump instruction offset size, but does not fit
to microMIPS jump offset size, we generate 'short' branch and later show
an error 'out of range PC16 fixup' after check in the isBranchOffsetInRange
routine.
Differential revision: https://reviews.llvm.org/D50615
llvm-svn: 340932
Simon Atanasyan [Wed, 29 Aug 2018 14:53:55 +0000 (14:53 +0000)]
[mips] Involves microMIPS's jump in the analyzable branch set
Involves microMIPS's jump in the analyzable branch set to reduce some
code patterns.
Differential revision: https://reviews.llvm.org/D50613
llvm-svn: 340931
Sanjay Patel [Wed, 29 Aug 2018 14:42:12 +0000 (14:42 +0000)]
[InstCombine] move declarations closer to uses; NFC
llvm-svn: 340930
Alexandre Ganea [Wed, 29 Aug 2018 14:28:04 +0000 (14:28 +0000)]
[Preamble] Fix incorrect usage of std::error_category
Differential Revision: https://reviews.llvm.org/D51380
llvm-svn: 340929
Jonas Toth [Wed, 29 Aug 2018 14:23:15 +0000 (14:23 +0000)]
[clang-tidy] Add abseil-no-internal-dependencies check
Finds instances where the user depends on internal details and warns them against doing so.
Should not be run on internal Abseil files or Abseil source code.
Patch by hugoeg!
Differential Revision: https://reviews.llvm.org/D50542
llvm-svn: 340928
Vladimir Stefanovic [Wed, 29 Aug 2018 14:07:14 +0000 (14:07 +0000)]
[mips] Prevent shrink-wrap for BuildPairF64, ExtractElementF64 when they use $sp
For a certain combination of options, BuildPairF64_{64}, ExtractElementF64{_64}
may be expanded into instructions using stack.
Add implicit operand $sp for such cases so that ShrinkWrapping doesn't move
prologue setup below them.
Fixes MultiSource/Benchmarks/MallocBench/cfrac for
'--target=mips-img-linux-gnu -mcpu=mips32r6 -mfpxx -mnan=2008'
and
'--target=mips-img-linux-gnu -mcpu=mips32r6 -mfp64 -mnan=2008 -mno-odd-spreg'.
Differential Revision: https://reviews.llvm.org/D50986
llvm-svn: 340927
Sanjay Patel [Wed, 29 Aug 2018 13:24:34 +0000 (13:24 +0000)]
[InstCombine] remove unnecessary shuffle undef folding
Add a test for constant folding to show that
(shuffle undef, undef, mask)
should already be handled via instsimplify.
llvm-svn: 340926
Alexandros Lamprineas [Wed, 29 Aug 2018 13:00:55 +0000 (13:00 +0000)]
Revert r340922 "[GVNHoist] Re-enable GVNHoist by default"
Another sanitizer buildbot failed this time at bootstrap when
compiling SemaTemplateInstantiate.cpp with this assertion:
`dominates(MD, U) && "Memory Def does not dominate it's uses"'.
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/15047
llvm-svn: 340925
Hans Wennborg [Wed, 29 Aug 2018 12:40:29 +0000 (12:40 +0000)]
Revert r340884 "Add a RingBuffer class to sanitizer_common"
The test doesn't pass on Windows, where sizeof(long) == 4 also
on 64-bit, and so it isn't a multiple of sizeof(void*).
This also reverts the follow-up r340886.
> Summary: a constrained RingBuffer optimized for fast push
>
> Reviewers: eugenis
>
> Reviewed By: eugenis
>
> Subscribers: kubamracek, mgorny, delcypher, #sanitizers, llvm-commits
>
> Differential Revision: https://reviews.llvm.org/D51196
llvm-svn: 340924
Hans Wennborg [Wed, 29 Aug 2018 12:21:32 +0000 (12:21 +0000)]
Revert r340921 "[NFC] Unify guards detection"
This broke the build, see e.g.
http://lab.llvm.org:8011/builders/clang-cmake-armv8-lnt/builds/4626/
http://lab.llvm.org:8011/builders/clang-ppc64be-linux-lnt/builds/18647/
http://lab.llvm.org:8011/builders/clang-cmake-x86_64-avx2-linux/builds/5856/
http://lab.llvm.org:8011/builders/lld-x86_64-freebsd/builds/22800/
> We have multiple places in code where we try to identify whether or not
> some instruction is a guard. This patch factors out this logic into a separate
> utility function which works uniformly in all places.
>
> Differential Revision: https://reviews.llvm.org/D51152
> Reviewed By: fedor.sergeev
llvm-svn: 340923
Alexandros Lamprineas [Wed, 29 Aug 2018 11:58:34 +0000 (11:58 +0000)]
[GVNHoist] Re-enable GVNHoist by default
Rebase rL338240 since the excessive memory usage observed when using
GVNHoist with UBSan has been fixed by rL340818.
Differential Revision: https://reviews.llvm.org/D49858
llvm-svn: 340922
Max Kazantsev [Wed, 29 Aug 2018 11:37:34 +0000 (11:37 +0000)]
[NFC] Unify guards detection
We have multiple places in code where we try to identify whether or not
some instruction is a guard. This patch factors out this logic into a separate
utility function which works uniformly in all places.
Differential Revision: https://reviews.llvm.org/D51152
Reviewed By: fedor.sergeev
llvm-svn: 340921
Aleksandar Beserminji [Wed, 29 Aug 2018 11:35:03 +0000 (11:35 +0000)]
[mips] Add missing instructions
Add pll.ps, plu.ps, cvt.s.pu, cvt.s.pl, cvt.ps instructions for FP64.
Differential Revision: https://reviews.llvm.org/D50437
llvm-svn: 340920
Simon Pilgrim [Wed, 29 Aug 2018 11:30:16 +0000 (11:30 +0000)]
[DAGCombiner] Add X / X -> 1 & X % X -> 0 folds
Adds more divrem folds to try and get in sync with InstructionSimplify
Differential Revision: https://reviews.llvm.org/D50636
llvm-svn: 340919
Aaron Ballman [Wed, 29 Aug 2018 11:29:07 +0000 (11:29 +0000)]
Introduce the abseil-redundant-strcat-calls check.
This flags redundant calls to absl::StrCat where the result is being passed to another call to absl::StrCat or absl::StrAppend. Patch by Hugo Gonzalez and Samuel Benzaquen.
llvm-svn: 340918
Simon Pilgrim [Wed, 29 Aug 2018 11:23:59 +0000 (11:23 +0000)]
[DAGCombiner] Add X / X -> 1 & X % X -> 0 folds (test tweaks)
Adjust missed test to avoid the X / X -> 1 & X % X -> 0 folds while keeping their original purposes.
Differential Revision: https://reviews.llvm.org/D50636
llvm-svn: 340917
Simon Pilgrim [Wed, 29 Aug 2018 11:18:14 +0000 (11:18 +0000)]
[DAGCombiner] Add X / X -> 1 & X % X -> 0 folds (test tweaks)
Adjust tests to avoid the X / X -> 1 & X % X -> 0 folds while keeping their original purposes.
Differential Revision: https://reviews.llvm.org/D50636
llvm-svn: 340916
Aaron Ballman [Wed, 29 Aug 2018 11:17:31 +0000 (11:17 +0000)]
Introduce the abseil-str-cat-append check.
This flags uses of absl::StrCat when absl::StrAppend should be used instead. Patch by Hugo Gonzalez and Benjamin Kramer.
llvm-svn: 340915
Max Kazantsev [Wed, 29 Aug 2018 10:51:59 +0000 (10:51 +0000)]
[NFC] Factor out guard utility methods into a separate file
This patch creates file GuardUtils which will contain logic for work with guards
that can be shared across different passes.
Differential Revision: https://reviews.llvm.org/D51151
Reviewed By: fedor.sergeev
llvm-svn: 340914
Simon Pilgrim [Wed, 29 Aug 2018 10:51:08 +0000 (10:51 +0000)]
[X86][AVX] Prefer VPBLENDW+VPBLENDD to VPBLENDVB for v16i16 blend shuffles
Noticed while looking at D49562 codegen - we can avoid a large constant mask load and a slow VPBLENDVB select op by using VPBLENDW+VPBLENDD instead.
TODO: As discussed on the patch, we should investigate adding VPBLENDVB handling to target shuffle combining as well, that will allow us to extend this to VPBLENDW+VPBLENDW+VPBLENDD.
Differential Revision: https://reviews.llvm.org/D50074
llvm-svn: 340913
Krasimir Georgiev [Wed, 29 Aug 2018 10:40:51 +0000 (10:40 +0000)]
[MC] fix a clang-tidy warning, NFC
Summary:
Per clang-tidy:
function 'llvm::MCStreamer::checkCVLocSection' has a definition with different parameter names
.../llvm/lib/MC/MCStreamer.cpp:275:18: the definition seen here
.../llvm/include/llvm/MC/MCStreamer.h:235:8: differing parameters are named here: ('FuncId'), in definition: ('FunctionId')
Reviewers: bkramer
Reviewed By: bkramer
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D51406
llvm-svn: 340912
Sam Parker [Wed, 29 Aug 2018 10:39:03 +0000 (10:39 +0000)]
[ARM] Set __ARM_FEATURE_SIMD32 for +dsp cores
ARM_FEATURE_DSP is already set for targets with the +dsp feature. In
the backend, this target feature is also used to represent the
availability of the of the instructions that the ACLE guard through
the __ARM_FEATURE_SIMD32 macro. We don't have any cores that
implement one and not the other, so set this macro for cores later
than V6 or for Cortex-M cores that the target parser, or user, reports
that the 'dsp' instructions are supported.
Differential Revision: https://reviews.llvm.org/D51093
llvm-svn: 340911
Simon Pilgrim [Wed, 29 Aug 2018 10:10:58 +0000 (10:10 +0000)]
Remove debug code accidently committed in rL340837. NFCI.
llvm-svn: 340908
Kamil Rytarowski [Wed, 29 Aug 2018 09:11:17 +0000 (09:11 +0000)]
Introduce new type for inteceptors UINTMAX_T
Summary:
The UINTMAX_T type will be used in new interceptors.
While there, correct the type of strtoumax(3) from INTMAX_T to UINTMAX_T.
Original patch from Yang Zheng.
Reviewers: vitalybuka, kcc, joerg
Reviewed By: vitalybuka
Subscribers: kubamracek, llvm-commits, tomsun.0.7, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D51106
llvm-svn: 340907
George Rimar [Wed, 29 Aug 2018 09:04:52 +0000 (09:04 +0000)]
Revert r340904 "[llvm-mc] - Allow to set custom flags for debug sections."
It broke PPC64 BB:
http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/23252
llvm-svn: 340906
Kirill Bobyrev [Wed, 29 Aug 2018 08:59:36 +0000 (08:59 +0000)]
[benchmark] NFC: Turn benchmark ON on all non-Windows buildbots
The problems with benchmark build should be fixed now, but Windows
buildbots still run into errors seemingly because of the bug in
clang-cl. Because of that, benchmark shouldn't be built on Windows at
this point.
llvm-svn: 340905
George Rimar [Wed, 29 Aug 2018 08:42:02 +0000 (08:42 +0000)]
[llvm-mc] - Allow to set custom flags for debug sections.
I am experimenting with a single split dwarf (.dwo sections in .o files).
I want to make linker to ignore .dwo sections in .o, for that I am trying to add
SHF_EXCLUDE flag ("E") for them in my asm sample.
I found that currently, it is impossible to add any flag for debug sections using llvm-mc.
That happens because we have a set of predefined unique sections created early with default flags:
https://github.com/llvm-mirror/llvm/blob/master/lib/MC/MCObjectFileInfo.cpp#L391
This patch allows a user to add any flags he wants.
I had to edit TargetLoweringObjectFileImpl.cpp to set MetaData type for debug sections.
Their kind was Data by default (so they were allocatable) and so after changes introduced by
this patch the SHF_ALLOC flag was applied for them, what does not make sense for debug sections.
One of OrcJITTests tests failed because of that.
Differential revision: https://reviews.llvm.org/D51361
llvm-svn: 340904
Nicolai Haehnle [Wed, 29 Aug 2018 07:46:09 +0000 (07:46 +0000)]
AMDGPU: Fix getInstSizeInBytes
Summary:
Add some optional code to validate getInstSizeInBytes for emitted
instructions. This flushed out some issues which are fixed by this
patch:
- Streamline getInstSizeInBytes
- Properly define the VI readlane/writelane instruction as VOP3
- Fix the inline constant determination. Specifically, this change
fixes an issue where a 32-bit value of 0xffffffff was recorded
as unsigned. This is equal to -1 when restricting to a 32-bit
comparison, and an inline constant can be used.
Reviewers: arsenm, rampitec
Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D50629
Change-Id: Id87c3b7975839da0de8156a124b0ce98c5fb47f2
llvm-svn: 340903
Rui Ueyama [Wed, 29 Aug 2018 07:27:09 +0000 (07:27 +0000)]
Always add a .note.GNU-stack section if -r.
With this patch, lld creates a .note.GNU_stack and adds that to an
output file if it is creating a re-linkable object file (i.e. if -r
is given). If we don't do this, and if you use GNU linkers as a final
linker, they create an executable whose stack area is executable,
which is considered pretty bad these days.
Differential Revision: https://reviews.llvm.org/D51400
llvm-svn: 340902
Aleksandr Urakov [Wed, 29 Aug 2018 07:26:11 +0000 (07:26 +0000)]
[PDB] Resolve a symbol context block info correctly
Summary:
This patch allows to resolve a symbol context block info even if a function
info was not requested. Also it adds the correct resolving of nested blocks
(the previous implementation used function blocks instead of them).
Reviewers: zturner, asmith, labath
Reviewed By: asmith
Subscribers: lldb-commits, stella.stamenova
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D51104
llvm-svn: 340901
Hans Wennborg [Wed, 29 Aug 2018 06:55:27 +0000 (06:55 +0000)]
LoopSink: Don't sink into blocks without an insertion point (PR38462)
In the PR, LoopSink was trying to sink into a catchswitch block, which
doesn't have a valid insertion point.
Differential Revision: https://reviews.llvm.org/D51307
llvm-svn: 340900
Craig Topper [Wed, 29 Aug 2018 04:45:33 +0000 (04:45 +0000)]
[SelectionDAG] Remove masked_gather/scatter from TargetSelectionDAG.td.
These aren't used in tree and the number of operands in the type profile is wrong. X86 uses its own ISD opcode and type profile after op legalization.
llvm-svn: 340899
Craig Topper [Wed, 29 Aug 2018 04:45:32 +0000 (04:45 +0000)]
[SelectionDAG] Add some comments to ISDOpcodes.h about the operands of MLOAD, MSTORE, MGATHER, MSCATTER. NFC
llvm-svn: 340898
Zachary Turner [Wed, 29 Aug 2018 04:12:44 +0000 (04:12 +0000)]
Add support for various C++14 demanglings.
Mostly this includes <auto> and <decltype-auto> return values.
Additionally, this fixes a fairly obscure back-referencing bug
that was encountered in one of the C++14 tests, which is that
if you have something like Foo<&bar, &bar> then the `bar`
forms a backreference.
llvm-svn: 340896
Zachary Turner [Wed, 29 Aug 2018 03:59:17 +0000 (03:59 +0000)]
[MS Demangler] Add output flags to all function calls.
Previously we had a FunctionSigFlags, but it's more flexible
to just have one set of output flags that apply to the entire
process and just pipe the entire set of flags through the
output process.
This will be useful when we start allowing the user to customize
the outputting behavior.
llvm-svn: 340894
Fedor Sergeev [Wed, 29 Aug 2018 03:53:30 +0000 (03:53 +0000)]
NFC. fixing time-passes test failure on Windows.
llvm-svn: 340893
Aditya Nandakumar [Wed, 29 Aug 2018 03:17:08 +0000 (03:17 +0000)]
[GISel]: Add legalization support for Widening UADDO/USUBO
https://reviews.llvm.org/D51384
Added code in LegalizerHelper to widen UADDO/USUBO along with unit
tests.
Reviewed by volkan.
llvm-svn: 340892
Craig Topper [Wed, 29 Aug 2018 02:12:49 +0000 (02:12 +0000)]
[X86] Support v2i32 gather/scatter indices with -x86-experimental-vector-widening-legalization
Summary: This is split out from D41062 to cover the code in LegalVectorTypes.cpp
Reviewers: RKSimon, spatel, efriedma
Reviewed By: efriedma
Subscribers: sdardis, jvesely, nhaehnle, jrtc27, atanasyan, llvm-commits
Differential Revision: https://reviews.llvm.org/D51337
llvm-svn: 340891
Fangrui Song [Wed, 29 Aug 2018 02:07:58 +0000 (02:07 +0000)]
[ELF] Change llvm-objdump -D to -d for check lines that only inspect text sections
Reviewers: ruiu, sfertile, syzaara, espindola
Subscribers: emaste, nemanjai, arichardson, kbarton, llvm-commits
Differential Revision: https://reviews.llvm.org/D51389
llvm-svn: 340890
Peter Collingbourne [Wed, 29 Aug 2018 01:38:47 +0000 (01:38 +0000)]
Start reserving x18 by default on Android targets.
Differential Revision: https://reviews.llvm.org/D45588
llvm-svn: 340889
Matt Davis [Wed, 29 Aug 2018 00:41:04 +0000 (00:41 +0000)]
[llvm-mca] Remove unused formal. NFC.
llvm-svn: 340888
Matt Davis [Wed, 29 Aug 2018 00:34:32 +0000 (00:34 +0000)]
[llvm-mca] Move the initialization of Pipeline. NFC.
Code cleanup to make the pipeline creation routine easier to read.
llvm-svn: 340887
Kostya Serebryany [Tue, 28 Aug 2018 23:50:59 +0000 (23:50 +0000)]
[sanitizer] fix a test
llvm-svn: 340886
Shoaib Meenai [Tue, 28 Aug 2018 23:47:22 +0000 (23:47 +0000)]
[LLDB] Fix script to work with GNU sed
GNU sed and BSD sed have a different command-line syntax for in-place
editing, and the current form of the script would only work with BSD
sed. The easiest way to get cross-platform behavior is to specify a
backup suffix and then just delete the backup file at the end. (BSD sed
is the default on macOS, but it's possible to acquire GNU coreutils and
have your `sed` be GNU sed even on macOS; I'm aware it's not officially
supported in any capacity, but it's easy enough to support here.)
An alternative would be using `perl -p -i -e` instead of `sed -i`, but I
figured it was best to make the minimal working change.
Differential Revision: https://reviews.llvm.org/D51374
llvm-svn: 340885
Kostya Serebryany [Tue, 28 Aug 2018 23:32:56 +0000 (23:32 +0000)]
Add a RingBuffer class to sanitizer_common
Summary: a constrained RingBuffer optimized for fast push
Reviewers: eugenis
Reviewed By: eugenis
Subscribers: kubamracek, mgorny, delcypher, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D51196
llvm-svn: 340884
Reid Kleckner [Tue, 28 Aug 2018 23:25:59 +0000 (23:25 +0000)]
[codeview] Clean up machinery for deferring .cv_loc emission
Now that we create the label at the point of the directive, we don't
need to set the "current CV location", and then later when we emit the
next instruction, create a label for it and emit it.
DWARF still defers the labels used in .debug_loc until the next
instruction or value, for reasons unknown.
llvm-svn: 340883
Zhaoshi Zheng [Tue, 28 Aug 2018 23:00:59 +0000 (23:00 +0000)]
[QTOOL-37352] Consider isLegalAddressingImm in Constant Hoisting
In Thumb1, legal imm range is [0, 255] for ADD/SUB instructions. However, the
legal imm range for LD/ST in (R+Imm) addressing mode is [0, 127]. Imms in
[128, 255] are materialized by mov R, #imm, and LD/STs use them in (R+R)
addressing mode.
This patch checks if a constant is used as offset in (R+Imm), if so, it checks
isLegalAddressingMode passing the constant value as BaseOffset.
Differential Revision: https://reviews.llvm.org/D50931
llvm-svn: 340882
Lang Hames [Tue, 28 Aug 2018 22:50:59 +0000 (22:50 +0000)]
[ORC] Add a testcase for r338975.
Tests that bad object files generate a predictable error from the JIT APIs.
llvm-svn: 340881
Frederic Riss [Tue, 28 Aug 2018 22:50:01 +0000 (22:50 +0000)]
Allow IRInterpreter to deal with non-power-of-2 sized types to support some bitfield accesses.
Summary:
For some bitfield patterns (like the one added by this commit), Clang will
generate non-regular data types like i24 or i48. This patch follows a
pretty naive approach of just bumping the type size to the next power of 2.
DataExtractor know how to deal with weird sizes. The operations on Scalar
do not know how to deal with those types though, so we have to legalize the
size when creating a Scalar.
Reviewers: jingham, clayborg
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D51245
llvm-svn: 340880
Craig Topper [Tue, 28 Aug 2018 22:32:14 +0000 (22:32 +0000)]
[X86] Add kadd intrinsics to match gcc and icc.
This adds the following intrinsics:
_kadd_mask64
_kadd_mask32
_kadd_mask16
_kadd_mask8
These are missing from the Intel Intrinsics Guide, but are implemented by both gcc and icc.
llvm-svn: 340879
Reid Kleckner [Tue, 28 Aug 2018 22:29:12 +0000 (22:29 +0000)]
[codeview] Emit labels for .cv_loc immediately
Previously we followed the DWARF implementation, which waits until the
next instruction or data to emit the label to use in the .debug_loc
section. We might want to consider re-evaluating that design choice as
well, since it means the .loc skips alignment padding, for better or
worse.
This was the most minimal fix I could come up with, but we should be
able to do a lot of cleanups now that we don't need to save a pending CV
location on the CodeViewContext. I plan to do those next, but this
immediately fixes an assertion for some of our users.
llvm-svn: 340878
Jason Molenda [Tue, 28 Aug 2018 22:28:34 +0000 (22:28 +0000)]
Remove unnecessary entitlement in debugserver for iOS.
<rdar://problem/
43631901>
llvm-svn: 340877
Raphael Isemann [Tue, 28 Aug 2018 22:17:28 +0000 (22:17 +0000)]
[lldb] Fix lldb build on musl
Summary: limits.h is needed for getting PATH_MAX definition, this comes to fore
with musl libc where limits.h is not included indirectly via other system headers.
Patch by Khem Raj, thanks!
Reviewers: compnerd
Reviewed By: compnerd
Subscribers: llvm-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D31275
llvm-svn: 340876
Craig Topper [Tue, 28 Aug 2018 22:05:55 +0000 (22:05 +0000)]
[X86] Remove GCCBuiltin from kadd intrinsics.
We need to custom handle it in clang so we can bit cast to the mask type.
llvm-svn: 340875
Lang Hames [Tue, 28 Aug 2018 21:18:05 +0000 (21:18 +0000)]
[ORC] Replace lookupFlags in JITSymbolResolver with getResponsibilitySet.
The new method name/behavior more closely models the way it was being used.
It also fixes an assertion that can occur when using the new ORC Core APIs,
where flags alone don't necessarily provide enough context to decide whether
the caller is responsible for materializing a given symbol (which was always
the reason this API existed).
The default implementation of getResponsibilitySet uses lookupFlags to determine
responsibility as before, so existing JITSymbolResolvers should continue to
work.
llvm-svn: 340874
Yaxun Liu [Tue, 28 Aug 2018 21:09:09 +0000 (21:09 +0000)]
[HIP] Fix output file extension
OffloadBundlingJobAction constructor accepts a list of JobAction as inputs.
The host JobAction is the last one. The file type of OffloadBundlingJobAction
should be determined by the host JobAction (the last one) instead of the first
one.
Since HIP emits LLVM bitcode for device compilation, device JobAction has
different file type as host Job Action. This bug causes incorrect output file
extension for HIP.
This patch fixes it by using the last input JobAction (host JobAction) to determine
file type of OffloadBundlingJobAction.
Differential Revision: https://reviews.llvm.org/D51336
llvm-svn: 340873
Fedor Sergeev [Tue, 28 Aug 2018 21:06:51 +0000 (21:06 +0000)]
[NFC][PassTiming] factor out generic PassTimingInfo
Moving PassTimingInfo from legacy pass manager code into a separate header.
Making it suitable for both legacy and new pass manager.
Adding a test on -time-passes main functionality.
llvm-svn: 340872