Fangrui Song [Thu, 11 Oct 2018 16:09:26 +0000 (16:09 +0000)]
[clang-move] Remove clang:: qualifier
Summary:
The use sites are enclosed by `namespace clang`, so clang:: is not
necessary. Many unqualified names have already been used, e.g. SourceManager SourceLocation LangOptions. This change makes the code terser and more consistent.
Reviewers: hokein
Reviewed By: hokein
Subscribers: ioeric, cfe-commits
Differential Revision: https://reviews.llvm.org/D53060
llvm-svn: 344256
Sanjay Patel [Thu, 11 Oct 2018 16:07:25 +0000 (16:07 +0000)]
[DAGCombiner] move comment closer to the corresponding code; NFC
llvm-svn: 344255
Marshall Clow [Thu, 11 Oct 2018 15:38:07 +0000 (15:38 +0000)]
Prefer to use the __is_XXX compiler intrinsics to the (old, busted) __has_XXX intrinsics when implementing type traits. Thanks to Richard Smith for the patch.
llvm-svn: 344254
Andrea Di Biagio [Thu, 11 Oct 2018 14:54:54 +0000 (14:54 +0000)]
[llvm-mca][BtVer2] Add tests for optimizable GPR register moves. NFC
llvm-svn: 344253
Eric Liu [Thu, 11 Oct 2018 14:52:33 +0000 (14:52 +0000)]
[lldb] Surpress copy-elison warning.
llvm-svn: 344252
Amara Emerson [Thu, 11 Oct 2018 14:51:11 +0000 (14:51 +0000)]
[InstCombine] Fix SimplifyLibCalls erasing an instruction while IC still had references to it.
InstCombine keeps a worklist and assumes that optimizations don't
eraseFromParent() the instruction, which SimplifyLibCalls violates. This change
adds a new callback to SimplifyLibCalls to let clients specify their own hander
for erasing actions.
Differential Revision: https://reviews.llvm.org/D52729
llvm-svn: 344251
Eric Liu [Thu, 11 Oct 2018 14:44:12 +0000 (14:44 +0000)]
[lldb] rename MinOS::minor to MinOS::minor_version etc. NFC
The constructor initializer minor(...)/major(...) can be confused with system
macros `#define minor(...)` on some platforms.
llvm-svn: 344250
Patrick Lyster [Thu, 11 Oct 2018 14:41:10 +0000 (14:41 +0000)]
Add support for 'dynamic_allocators' clause on 'requires' directive. Differential Revision: https://reviews.llvm.org/D53079
llvm-svn: 344249
Diogo N. Sampaio [Thu, 11 Oct 2018 14:10:32 +0000 (14:10 +0000)]
[AARCH64][FIX] Emit data symbol for constant pool data
The ARM64 elf emitter would omit printing data
symbol for zero filled constant data. This patch
overrides the emitFill method as to enforce that
the symbol is correctly printed.
Differential revision: https://reviews.llvm.org/D53132
llvm-svn: 344248
Sam McCall [Thu, 11 Oct 2018 13:42:53 +0000 (13:42 +0000)]
[Tooling] Move CompilationDatabasePlugin to the Registry header, where it's useful. NFC
llvm-svn: 344247
Andrew Savonichev [Thu, 11 Oct 2018 13:35:34 +0000 (13:35 +0000)]
[Sema][OpenCL] Improve diagnostics for not viable overloadable function candidates
Summary:
Allowed extension name (that ought to be disabled) printing in the note message.
This diagnostic was proposed here: https://reviews.llvm.org/D51341
Reviewers: Anastasia, yaxunl
Reviewed By: Anastasia
Subscribers: cfe-commits, asavonic, bader
Differential Revision: https://reviews.llvm.org/D52292
llvm-svn: 344246
Sam McCall [Thu, 11 Oct 2018 13:06:10 +0000 (13:06 +0000)]
[clangd] Remove no-op crash handler, we never set a crash context.
Summary:
I think this was just copied from somewhere with the belief that it actually
did some crash handling.
Of course the question arises: *should* we set one? I don't think so:
- clangd used to crash a lot, now it's pretty stable, because we found and
fixed the crashes. I think the long-term effects of crashing hard are good.
- the implementation can't do any magic, it just uses longjmp to return without
running any destructors by default. This is unsafe in general (e.g. mutexes
won't unlock) and will certainly end up leaking memory. Whatever UB caused
the crash may still stomp all over global state, etc.
I think there's an argument for isolating the background indexer (autoindex)
because it's not directly under the user's control, the crash surface is larger,
and it doesn't particularly need to interact with the rest of clangd.
But there, fork() and communicate through the FS is safer.
Reviewers: ioeric, ilya-biryukov
Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D53034
llvm-svn: 344245
Aaron Ballman [Thu, 11 Oct 2018 12:57:29 +0000 (12:57 +0000)]
Revert r344241 as it broke multiple bots.
http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/10814
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/20613
llvm-svn: 344244
Dylan McKay [Thu, 11 Oct 2018 12:49:50 +0000 (12:49 +0000)]
Generalize an IR verifier check to work with non-zero program address spaces
This commit modifies an existing IR verifier check that
assumes all functions will be located in the default address
space 0.
Rather than using the default paramater value getPointerTo(AddrSpace=0),
explicitly specify the program memory address space from the data layout.
This only affects targets that specify a nonzero address space
in their data layouts. The only in-tree target that does this
is AVR.
llvm-svn: 344243
Kristof Umann [Thu, 11 Oct 2018 11:58:53 +0000 (11:58 +0000)]
[analyzer][UninitializedObjectChecker] Reports Loc fields pointing to themselves
I've added a new functionality, the checker is now able to
detect and report fields pointing to themselves. I figured
this would fit well into the checker as there's no reason
for a pointer to point to itself instead of being nullptr.
Differential Revision: https://reviews.llvm.org/D51305
llvm-svn: 344242
Michal Gorny [Thu, 11 Oct 2018 11:58:14 +0000 (11:58 +0000)]
[tests] Include Python binding tests in CMake rules
Add a new CMake rule check-clang-python to run the Python bindings'
test suite, and include it in check-all.
Differential Revision: https://reviews.llvm.org/D52840
llvm-svn: 344241
Michal Gorny [Thu, 11 Oct 2018 11:58:07 +0000 (11:58 +0000)]
[python] [tests] Support overriding library path via environment
Support a new CLANG_LIBRARY_PATH environment variable for the Python
binding tests. This variable can be used to force the bindings to load
libclang.* from a specific directory.
I plan to use this when integrating Python binding tests with the CMake
build system. Currently, those tests load libclang.so from default
search paths, so I would have to rely on platform-specific mechanics
such as LD_LIBRARY_PATH. Instead of copying the whole logic necessary
to handle platform differences into yet another place, it's easier to
just add a dedicated variable for this purpose.
Differential Revision: https://reviews.llvm.org/D52806
llvm-svn: 344240
David Green [Thu, 11 Oct 2018 11:28:27 +0000 (11:28 +0000)]
[InstCombine] Demand bits of UMin
This is the umin alternative to the umax code from rL344237. We use
DeMorgans law on the umax case to bring us to the same thing on umin,
but using countLeadingOnes, not countLeadingZeros.
Differential Revision: https://reviews.llvm.org/D53036
llvm-svn: 344239
Alex Bradbury [Thu, 11 Oct 2018 11:11:58 +0000 (11:11 +0000)]
[RISCV] Re-generate test/CodeGen/RISCV/vararg.ll after r344142
The improved load-store forwarding committed in r344142 broke this test.
llvm-svn: 344238
David Green [Thu, 11 Oct 2018 11:04:09 +0000 (11:04 +0000)]
[InstCombine] Demand bits of UMax
Use the demanded bits of umax(A,C) to prove we can just use A so long as the
lowest non-zero bit of DemandMask is higher than the highest non-zero bit of C
Differential Revision: https://reviews.llvm.org/D53033
llvm-svn: 344237
David Green [Thu, 11 Oct 2018 10:46:12 +0000 (10:46 +0000)]
[InstCombine] Add tests for demand bits of min/max. NFC.
llvm-svn: 344236
Andrea Di Biagio [Thu, 11 Oct 2018 10:39:03 +0000 (10:39 +0000)]
[tblgen][CodeGenSchedule] Add a check for invalid RegisterFile definitions with zero physical registers.
llvm-svn: 344235
Hans Wennborg [Thu, 11 Oct 2018 10:04:15 +0000 (10:04 +0000)]
clang-cl: Add /showFilenames option (PR31957)
Add a /showFilenames option for users who want clang to echo the
currently compiled filename. MSVC does this echoing by default, and it's
useful for showing progress in build systems that doesn't otherwise
provide any progress report, such as MSBuild.
Differential Revision: https://reviews.llvm.org/D52773
llvm-svn: 344234
Florian Hahn [Thu, 11 Oct 2018 09:46:25 +0000 (09:46 +0000)]
[LV] Use SmallVector instead of DenseMap in calculateRegisterUsage (NFC).
We assign indices sequentially for seen instructions, so we can just use
a vector and push back the seen instructions. No need for using a
DenseMap.
Reviewers: hsaito, rengolin, nadav, dcaballe
Reviewed By: rengolin
Differential Revision: https://reviews.llvm.org/D53089
llvm-svn: 344233
Florian Hahn [Thu, 11 Oct 2018 09:27:24 +0000 (09:27 +0000)]
[LV] Ignore more debug info.
We can avoid doing some unnecessary work by skipping debug instructions
in a few loops. It also helps to ensure debug instructions do not
prevent vectorization, although I do not have any concrete test cases
for that.
Reviewers: rengolin, hsaito, dcaballe, aprantl, vsk
Reviewed By: rengolin, dcaballe
Differential Revision: https://reviews.llvm.org/D53091
llvm-svn: 344232
Roman Lebedev [Thu, 11 Oct 2018 09:09:52 +0000 (09:09 +0000)]
[compiler-rt][ubsan] Split Implicit Integer Truncation Sanitizer into unsigned and signed checks
Summary:
This is compiler-rt part.
clang part is D50901.
Reviewers: rsmith, vsk, filcab, Sanitizers
Reviewed by: filcab
Differential Revision: https://reviews.llvm.org/D50902
llvm-svn: 344231
Roman Lebedev [Thu, 11 Oct 2018 09:09:50 +0000 (09:09 +0000)]
[clang][ubsan] Split Implicit Integer Truncation Sanitizer into unsigned and signed checks
Summary:
As per IRC disscussion, it seems we really want to have more fine-grained `-fsanitize=implicit-integer-truncation`:
* A check when both of the types are unsigned.
* Another check for the other cases (either one of the types is signed, or both of the types is signed).
This is clang part.
Compiler-rt part is D50902.
Reviewers: rsmith, vsk, Sanitizers
Reviewed by: rsmith
Differential Revision: https://reviews.llvm.org/D50901
llvm-svn: 344230
Calixte Denizet [Thu, 11 Oct 2018 08:53:55 +0000 (08:53 +0000)]
[profile] Fix the gcov tests after the patch in D49853 landed.
Summary:
The goal of the patch in D49853 is to display counter on the line of function definition.
So some tests need to be fixed.
Reviewers: marco-c, davidxl
Reviewed By: marco-c
Subscribers: sylvestre.ledru, delcypher, llvm-commits, #sanitizers
Differential Revision: https://reviews.llvm.org/D49854
llvm-svn: 344229
Calixte Denizet [Thu, 11 Oct 2018 08:53:43 +0000 (08:53 +0000)]
[gcov] Display the hit counter for the line of a function definition
Summary:
Right now there is no hit counter on the line of function.
So the idea is add the line of the function to all the lines covered by the entry block.
Tests in compiler-rt/profile will be fixed in another patch: https://reviews.llvm.org/D49854
Reviewers: marco-c, davidxl
Reviewed By: marco-c
Subscribers: sylvestre.ledru, llvm-commits
Differential Revision: https://reviews.llvm.org/D49853
llvm-svn: 344228
Max Kazantsev [Thu, 11 Oct 2018 08:46:39 +0000 (08:46 +0000)]
[NFC] Factor out getOrCreateAddRecExpr method
llvm-svn: 344227
George Rimar [Thu, 11 Oct 2018 08:25:35 +0000 (08:25 +0000)]
[ELF] - Set sh_info and sh_link for .rela.plt sections.
This is https://bugs.llvm.org/show_bug.cgi?id=37538,
Currently, LLD may set both sh_link and sh_info for
.rela.plt section to zero when we have only .rela.iplt section part used.
ELF spec (https://docs.oracle.com/cd/E19683-01/816-1386/chapter6-94076/index.html)
says that for SHT_REL and SHT_RELA, sh_link references the associated symbol table
and sh_info the "section to which the relocation applies."
When we set the sh_link field, for the regular case we use the .dynsym index.
For .rela.iplt sections, it is unclear what is the associated symbol table,
because R_*_RELATIVE relocations do not use symbol names and we might have no
.dynsym section at all so this patch uses .symtab section index.
Differential revision: https://reviews.llvm.org/D52830
llvm-svn: 344226
Chandler Carruth [Thu, 11 Oct 2018 08:05:10 +0000 (08:05 +0000)]
Fix the qualification of `IntrusiveRefCntPtr` to use `llvm::`.
Without this, the code only compiled if the header was included after
something introduced the alias from `clang::` to `llvm::` for this type.
Any modules build would fail here.
llvm-svn: 344225
Roman Lebedev [Thu, 11 Oct 2018 07:51:13 +0000 (07:51 +0000)]
[X86][BMI1]: X86DAGToDAGISel: select BEXTR from x & ~(-1 << nbits) pattern
Summary:
As discussed in D48491, we can't really do this in the TableGen,
since we need to produce *two* instructions. This only implements
one single pattern. The other 3 patterns will be in follow-ups.
I'm not sure yet if we want to also fuse shift into here
(i.e `(x >> start) & ...`)
Reviewers: RKSimon, craig.topper, spatel
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D52304
llvm-svn: 344224
Max Kazantsev [Thu, 11 Oct 2018 07:22:26 +0000 (07:22 +0000)]
[IndVars] Drop "exact" flag from lshr and udiv when substituting their args
There is a transform that may replace `lshr (x+1), 1` with `lshr x, 1` in case
if it can prove that the result will be the same. However the initial instruction
might have an `exact` flag set, and it now should be dropped unless we prove
that it may hold. Incorrectly set `exact` attribute may then produce poison.
Differential Revision: https://reviews.llvm.org/D53061
Reviewed By: sanjoy
llvm-svn: 344223
Martin Storsjo [Thu, 11 Oct 2018 06:53:38 +0000 (06:53 +0000)]
[llvm-nm] Include the text "@FILE" in the output of --help
libtool requires this text to be present, in order to conclude that
the tool supports response files. Also add an explicit test of using
response files with llvm-nm.
Differential Revision: https://reviews.llvm.org/D53064
llvm-svn: 344222
Marshall Clow [Thu, 11 Oct 2018 04:07:20 +0000 (04:07 +0000)]
Add a test that shows what happens with throwing destructors. NFC.
llvm-svn: 344220
Chris Bieneman [Thu, 11 Oct 2018 04:06:14 +0000 (04:06 +0000)]
[CMake] Temporarily remove the LLVM_ENABLE_IDE option
All uses of this option have been removed, and the intent is to change the purpose and default value of this option. To prevent it from having impacts on users, this patch temporarily removes the option and purges it from CMake caches. In a few days, once this has propagated to contributors I will re-introduce the option with the new default value.
llvm-svn: 344219
Chris Bieneman [Thu, 11 Oct 2018 04:02:53 +0000 (04:02 +0000)]
[CMake] Unconditionally add .h and .td files to target sources
Previously adding header and table gen files was conditional on using an IDE. Since these files have the `HEADER_FILE_ONLY` attribute applied they are ignored as sources by all non-IDE generators, so there is really no reason not to include them.
Additionally having the CMake always include these files allows the CMake-server to include them in the sources list for targets, which is valuable to anyone using CMake-server integrated tools.
llvm-svn: 344218
Chris Bieneman [Thu, 11 Oct 2018 04:00:51 +0000 (04:00 +0000)]
[Coverage] Apply filtered paths to summary
Summary:
The script to generate code coverage reports supports passing filter paths to llvm-cov when generating the HTML reports, but doesn't pass those paths to the summary generation as well. This results in a summary report that doesn't match the HTML report.
This patch addresses the problem by also passing the filter paths to the summary report generation.
Reviewers: vsk
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D53110
llvm-svn: 344217
Zachary Turner [Thu, 11 Oct 2018 03:42:17 +0000 (03:42 +0000)]
Use fully qualified namespace name.
llvm::detail is not the only namespace named detail. So if
someone has done a `using namespace llvm::support`, for example,
this will fail with an ambiguous namespace name. Granted
people generally shouldn't be using large namespaces like that,
but it's common at local function scopes.
llvm-svn: 344216
Eric Fiselier [Thu, 11 Oct 2018 03:01:14 +0000 (03:01 +0000)]
Use C++03 friendly version of alignof
llvm-svn: 344215
Eric Fiselier [Thu, 11 Oct 2018 01:48:00 +0000 (01:48 +0000)]
Fix use of removed _LIBCPP_HAS_NO_BUILTIN_ALIGNED_OPERATOR_NEW_DELETE
It was replaced with the better named
_LIBCPP_HAS_NO_BUILTIN_OVERLOADED_OPERATOR_NEW_DELETE.
llvm-svn: 344214
Kostya Serebryany [Thu, 11 Oct 2018 01:05:18 +0000 (01:05 +0000)]
[hwasan] extend the stack-uar test
llvm-svn: 344213
Fangrui Song [Thu, 11 Oct 2018 00:58:00 +0000 (00:58 +0000)]
Eliminate dependency to formatv(). NFC.
llvm-svn: 344212
Thomas Lively [Thu, 11 Oct 2018 00:49:24 +0000 (00:49 +0000)]
[WebAssembly][NFC] Use intrinsic dag nodes directly
Summary: Instead of custom lowering to WebAssemblyISD nodes first.
Reviewers: aheejin, dschuff
Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D53119
llvm-svn: 344211
Kostya Serebryany [Thu, 11 Oct 2018 00:34:20 +0000 (00:34 +0000)]
[hwasan] more compact printing for 'Previosly allocated frames'
llvm-svn: 344210
Jason Molenda [Thu, 11 Oct 2018 00:28:35 +0000 (00:28 +0000)]
Upstreaming the BridgeOS device support and the
LC_BUILD_VERSION load command handling - this
commit is a combination of patches by Adrian
Prantl and myself. llvm::Triple::BridgeOS
isn't defined yet, so all references to that
are currently commented out.
Also update Xcode project file to build the
NativePDB etc plugins.
<rdar://problem/
43353615>
llvm-svn: 344209
Eric Fiselier [Thu, 11 Oct 2018 00:18:54 +0000 (00:18 +0000)]
Update libc++abi's detection of aligned allocation after r344207.
llvm-svn: 344208
Eric Fiselier [Thu, 11 Oct 2018 00:17:24 +0000 (00:17 +0000)]
Distinguish between library and language support for aligned allocation.
There are two cases:
1. The library has all it needs to provide align_val_t and the
new/delete overloads needed to support aligned allocation.
2. The compiler has actually turned the language feature on.
There are times where libc++ needs to distinguish between the two.
This patch adds the additional macro
_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION which denotes when case (1)
does not hold. _LIBCPP_HAS_NO_ALIGNED_ALLOCATION is defined whenever
_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION is defined, or when the
compiler has not enabled the language feature.
Additionally this patch cleans up a number of other macros related
to detection of aligned allocation machinery.
llvm-svn: 344207
Fangrui Song [Thu, 11 Oct 2018 00:08:59 +0000 (00:08 +0000)]
[MC][ELF] Fix section_mergeable_size.ll
Some targets use %progbits instead of @progbits.
Updating that check with a {{[@%]}}progbits regex to make those bots happy.
llvm-svn: 344206
Thomas Lively [Thu, 11 Oct 2018 00:07:55 +0000 (00:07 +0000)]
[WebAssembly] Saturating float-to-int builtins
Summary: Depends on D53007 and D53004.
Reviewers: aheejin, dschuff
Subscribers: sbc100, jgravelle-google, sunfish, kristina, cfe-commits
Differential Revision: https://reviews.llvm.org/D53009
llvm-svn: 344205
Thomas Lively [Thu, 11 Oct 2018 00:01:25 +0000 (00:01 +0000)]
[WebAssembly] Saturating float to int intrinsics
Summary:
Although the saturating float to int instructions are already
emitted from normal IR, the fpto{s,u}i instructions produce poison
values if the argument cannot fit in the result type. These intrinsics
are therefore necessary to get guaranteed defined saturating behavior.
Reviewers: aheejin, dschuff
Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D53004
llvm-svn: 344204
Kostya Serebryany [Wed, 10 Oct 2018 23:57:38 +0000 (23:57 +0000)]
[hwasan] simplify a test
llvm-svn: 344203
Saleem Abdulrasool [Wed, 10 Oct 2018 23:53:12 +0000 (23:53 +0000)]
llvm-c: Add C APIs to access DebugLoc info
Add thin shims to C interface to provide access to DebugLoc info for
Instructions, GlobalVariables and Functions. Patch by Josh Berdine!
llvm-svn: 344202
Richard Smith [Wed, 10 Oct 2018 23:33:18 +0000 (23:33 +0000)]
Update documentation to indicate that profile remapping support is only
implemented for the new pass manager so far.
llvm-svn: 344201
Richard Smith [Wed, 10 Oct 2018 23:13:47 +0000 (23:13 +0000)]
Add a flag to remap manglings when reading profile data information.
This can be used to preserve profiling information across codebase
changes that have widespread impact on mangled names, but across which
most profiling data should still be usable. For example, when switching
from libstdc++ to libc++, or from the old libstdc++ ABI to the new ABI,
or even from a 32-bit to a 64-bit build.
The user can provide a remapping file specifying parts of mangled names
that should be treated as equivalent (eg, std::__1 should be treated as
equivalent to std::__cxx11), and profile data will be treated as
applying to a particular function if its name is equivalent to the name
of a function in the profile data under the provided equivalences. See
the documentation change for a description of how this is configured.
Remapping is supported for both sample-based profiling and instruction
profiling. We do not support remapping indirect branch target
information, but all other profile data should be remapped
appropriately.
Support is only added for the new pass manager. If someone wants to also
add support for this for the old pass manager, doing so should be
straightforward.
This is the LLVM side of Clang r344199.
Reviewers: davidxl, tejohnson, dlj, erik.pilkington
Subscribers: mehdi_amini, steven_wu, dexonsmith, llvm-commits
Differential Revision: https://reviews.llvm.org/D51249
llvm-svn: 344200
Richard Smith [Wed, 10 Oct 2018 23:13:35 +0000 (23:13 +0000)]
Add a flag to remap manglings when reading profile data information.
This can be used to preserve profiling information across codebase
changes that have widespread impact on mangled names, but across which
most profiling data should still be usable. For example, when switching
from libstdc++ to libc++, or from the old libstdc++ ABI to the new ABI,
or even from a 32-bit to a 64-bit build.
The user can provide a remapping file specifying parts of mangled names
that should be treated as equivalent (eg, std::__1 should be treated as
equivalent to std::__cxx11), and profile data will be treated as
applying to a particular function if its name is equivalent to the name
of a function in the profile data under the provided equivalences. See
the documentation change for a description of how this is configured.
Remapping is supported for both sample-based profiling and instruction
profiling. We do not support remapping indirect branch target
information, but all other profile data should be remapped
appropriately.
Support is only added for the new pass manager. If someone wants to also
add support for this for the old pass manager, doing so should be
straightforward.
llvm-svn: 344199
Warren Ristow [Wed, 10 Oct 2018 22:54:31 +0000 (22:54 +0000)]
[LTO] Account for overriding lib calls via the alias attribute
Given a library call that is represented as an llvm intrinsic call, but
later transformed to an actual call, if an overriding definition of that
library routine is provided indirectly via an alias, prevent LTO from
eliminating the definition.
This is a fix for PR38547.
Differential Revision: https://reviews.llvm.org/D52836
llvm-svn: 344198
Nick Desaulniers [Wed, 10 Oct 2018 22:52:32 +0000 (22:52 +0000)]
[MC][ELF] compute entity size for explicit sections
Summary:
Global variables might declare themselves to be in explicit sections.
Calculate the entity size always to prevent assembler warnings
"entity size for SHF_MERGE not specified" when sections are to be
marked merge-able.
Fixes PR31828.
Reviewers: rnk, echristo
Reviewed By: rnk
Subscribers: llvm-commits, pirama, srhines
Differential Revision: https://reviews.llvm.org/D53056
llvm-svn: 344197
Rui Ueyama [Wed, 10 Oct 2018 22:49:29 +0000 (22:49 +0000)]
Make a member function private and rename it to avoid function overloading.
llvm-svn: 344196
Fangrui Song [Wed, 10 Oct 2018 22:48:57 +0000 (22:48 +0000)]
[ELF] Don't warn on undefined symbols if UnresolvedPolicy::Ignore is used
Summary:
Add a condition UnresolvedPolicy::Ignore to elf::warnUnorderedSymbol to suppress Sym->isUndefined() warnings from both
1) --symbol-ordering-file=
2) .llvm.call-graph-profile
If --unresolved-symbols=ignore-all is used,
no "undefined symbol" error/warning is emitted. It makes sense to not warn unorderable symbols.
Otherwise,
If an executable is linked, the default policy UnresolvedPolicy::ErrorOrWarn will issue a "undefined symbol" error. The unorderable symbol warning is redundant.
If a shared object is linked, it is possible that only part of object files are used and some symbols are left undefined. The warning is not very necessary.
In particular for .llvm.call-graph-profile, when linking a shared object, a call graph profile may contain undefined symbols. This case generated a warning before but it will be suppressed by this patch.
Reviewers: ruiu, davidxl, espindola
Reviewed By: ruiu
Subscribers: grimar, emaste, arichardson, llvm-commits
Differential Revision: https://reviews.llvm.org/D53044
llvm-svn: 344195
Aaron Puchert [Wed, 10 Oct 2018 22:35:24 +0000 (22:35 +0000)]
Use TEST_STD_VER instead of __cplusplus [NFC]
While __cplusplus was only used a few dozen times, TEST_STD_VAR is used
more than 2000 times. So we replace the former by the latter for
consistency in the tests. There should be no functional change.
llvm-svn: 344194
Kostya Serebryany [Wed, 10 Oct 2018 22:24:44 +0000 (22:24 +0000)]
[hwasan] when reporting a bug, print some very basic information about the heap chunk (in addition to the more detailed info that we may fail to show)
llvm-svn: 344193
Aaron Puchert [Wed, 10 Oct 2018 22:05:33 +0000 (22:05 +0000)]
Use std::scoped_lock only for C++17 and newer
This fixes a test failure caused by D53049.
llvm-svn: 344192
Louis Dionne [Wed, 10 Oct 2018 22:00:58 +0000 (22:00 +0000)]
[libcxxabi] Allow building with sanitizers enabled
Summary:
I copied the sanitizer-related logic in libcxx/lib/CMakeLists.txt. In
the future, it would be great to avoid duplicating this logic in the
compiler, libc++ and libc++abi.
Reviewers: EricWF
Subscribers: mgorny, christof, dexonsmith, libcxx-commits, davide
Differential Revision: https://reviews.llvm.org/D53028
llvm-svn: 344191
Reid Kleckner [Wed, 10 Oct 2018 21:59:56 +0000 (21:59 +0000)]
[AST] Use -fvisibility value when ignoring -fv-i-h* inline static locals
Summary:
In r340386 we added code to give static locals in inline functions
default visibility. Instead, we should use the "default" visibility
passed on the command line, which could be hidden or protected, as GCC
does.
Some code bases use both -fvisibility=hidden and
-fvisibility-inlines-hidden to hide inline functions of classes that are
explicitly marked with default visibility.
Fixes PR39236
Reviewers: hans, thakis
Subscribers: eraman, llvm-commits
Differential Revision: https://reviews.llvm.org/D53052
llvm-svn: 344190
Craig Topper [Wed, 10 Oct 2018 21:48:34 +0000 (21:48 +0000)]
[X86] Prevent non-temporal loads from folding into instructions by blocking them in X86DAGToDAGISel::IsProfitableToFold rather than with a predicate.
Remove tryFoldVecLoad since tryFoldLoad would call IsProfitableToFold and pick up the new check.
This saves about 5K out of ~600K on the generated isel table.
llvm-svn: 344189
Chris Bieneman [Wed, 10 Oct 2018 21:36:12 +0000 (21:36 +0000)]
[CMake] NFC. Updating documentation on options
The Ninja pool options are only supported with the Ninja generator and
should be called out as such.
llvm-svn: 344188
Richard Smith [Wed, 10 Oct 2018 21:31:01 +0000 (21:31 +0000)]
Support for remapping profile data when symbols change, for sample-based
profiling.
Reviewers: davidxl, tejohnson, dlj, erik.pilkington
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D51248
llvm-svn: 344187
George Burgess IV [Wed, 10 Oct 2018 21:28:44 +0000 (21:28 +0000)]
Replace most users of UnknownSize with LocationSize::unknown(); NFC
Moving away from UnknownSize is part of the effort to migrate us to
LocationSizes (e.g. the cleanup promised in D44748).
This doesn't entirely remove all of the uses of UnknownSize; some uses
require tweaks to assume that UnknownSize isn't just some kind of int.
This patch is intended to just be a trivial replacement for all places
where LocationSize::unknown() will Just Work.
llvm-svn: 344186
Armando Montanez [Wed, 10 Oct 2018 21:16:57 +0000 (21:16 +0000)]
Test commit: fix typo in comment
llvm-svn: 344185
Richard Smith [Wed, 10 Oct 2018 21:09:37 +0000 (21:09 +0000)]
Support for remapping profile data when symbols change, for
instrumentation-based profiling.
Reviewers: davidxl, tejohnson, dlj, erik.pilkington
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D51247
llvm-svn: 344184
James Y Knight [Wed, 10 Oct 2018 21:07:02 +0000 (21:07 +0000)]
llvm-ar: Darwin archive format fixes.
* Support writing the DARWIN64 symbol table format.
* In darwin archives, emit a symbol table whenever requested, even
when there are no members, as the apple linker will abort if given
an archive without a symbol table.
Added tests for same, and also simplified and moved the GNU 64-bit
symbol table test into archive-symtab.test.
llvm-svn: 344183
Roman Lebedev [Wed, 10 Oct 2018 20:50:52 +0000 (20:50 +0000)]
[NFC][X86][AArch64] extract-bits.ll: add tests with constants+storing results.
As noted in https://reviews.llvm.org/D53080#inline-467678,
this *may* get pessimized by that diff.
llvm-svn: 344182
Sanjay Patel [Wed, 10 Oct 2018 20:47:46 +0000 (20:47 +0000)]
[InstCombine] reverse 'trunc X to <N x i1>' canonicalization; 2nd try
Re-trying r344082 because it unintentionally included extra diffs.
Original commit message:
icmp ne (and X, 1), 0 --> trunc X to N x i1
Ideally, we'd do the same for scalars, but there will likely be
regressions unless we add more trunc folds as we're doing here
for vectors.
The motivating vector case is from PR37549:
https://bugs.llvm.org/show_bug.cgi?id=37549
define <4 x float> @bitwise_select(<4 x float> %x, <4 x float> %y, <4 x float> %z, <4 x float> %w) {
%c = fcmp ole <4 x float> %x, %y
%s = sext <4 x i1> %c to <4 x i32>
%s1 = shufflevector <4 x i32> %s, <4 x i32> undef, <4 x i32> <i32 0, i32 0, i32 1, i32 1>
%s2 = shufflevector <4 x i32> %s, <4 x i32> undef, <4 x i32> <i32 2, i32 2, i32 3, i32 3>
%cond = or <4 x i32> %s1, %s2
%condtr = trunc <4 x i32> %cond to <4 x i1>
%r = select <4 x i1> %condtr, <4 x float> %z, <4 x float> %w
ret <4 x float> %r
}
Here's a sampling of the vector codegen for that case using
mask+icmp (current behavior) vs. trunc (with this patch):
AVX before:
vcmpleps %xmm1, %xmm0, %xmm0
vpermilps $80, %xmm0, %xmm1 ## xmm1 = xmm0[0,0,1,1]
vpermilps $250, %xmm0, %xmm0 ## xmm0 = xmm0[2,2,3,3]
vorps %xmm0, %xmm1, %xmm0
vandps LCPI0_0(%rip), %xmm0, %xmm0
vxorps %xmm1, %xmm1, %xmm1
vpcmpeqd %xmm1, %xmm0, %xmm0
vblendvps %xmm0, %xmm3, %xmm2, %xmm0
AVX after:
vcmpleps %xmm1, %xmm0, %xmm0
vpermilps $80, %xmm0, %xmm1 ## xmm1 = xmm0[0,0,1,1]
vpermilps $250, %xmm0, %xmm0 ## xmm0 = xmm0[2,2,3,3]
vorps %xmm0, %xmm1, %xmm0
vblendvps %xmm0, %xmm2, %xmm3, %xmm0
AVX512f before:
vcmpleps %xmm1, %xmm0, %xmm0
vpermilps $80, %xmm0, %xmm1 ## xmm1 = xmm0[0,0,1,1]
vpermilps $250, %xmm0, %xmm0 ## xmm0 = xmm0[2,2,3,3]
vorps %xmm0, %xmm1, %xmm0
vpbroadcastd LCPI0_0(%rip), %xmm1 ## xmm1 = [1,1,1,1]
vptestnmd %zmm1, %zmm0, %k1
vblendmps %zmm3, %zmm2, %zmm0 {%k1}
AVX512f after:
vcmpleps %xmm1, %xmm0, %xmm0
vpermilps $80, %xmm0, %xmm1 ## xmm1 = xmm0[0,0,1,1]
vpermilps $250, %xmm0, %xmm0 ## xmm0 = xmm0[2,2,3,3]
vorps %xmm0, %xmm1, %xmm0
vpslld $31, %xmm0, %xmm0
vptestmd %zmm0, %zmm0, %k1
vblendmps %zmm2, %zmm3, %zmm0 {%k1}
AArch64 before:
fcmge v0.4s, v1.4s, v0.4s
zip1 v1.4s, v0.4s, v0.4s
zip2 v0.4s, v0.4s, v0.4s
orr v0.16b, v1.16b, v0.16b
movi v1.4s, #1
and v0.16b, v0.16b, v1.16b
cmeq v0.4s, v0.4s, #0
bsl v0.16b, v3.16b, v2.16b
AArch64 after:
fcmge v0.4s, v1.4s, v0.4s
zip1 v1.4s, v0.4s, v0.4s
zip2 v0.4s, v0.4s, v0.4s
orr v0.16b, v1.16b, v0.16b
bsl v0.16b, v2.16b, v3.16b
PowerPC-le before:
xvcmpgesp 34, 35, 34
vspltisw 0, 1
vmrglw 3, 2, 2
vmrghw 2, 2, 2
xxlor 0, 35, 34
xxlxor 35, 35, 35
xxland 34, 0, 32
vcmpequw 2, 2, 3
xxsel 34, 36, 37, 34
PowerPC-le after:
xvcmpgesp 34, 35, 34
vmrglw 3, 2, 2
vmrghw 2, 2, 2
xxlor 0, 35, 34
xxsel 34, 37, 36, 0
Differential Revision: https://reviews.llvm.org/D52747
llvm-svn: 344181
Thomas Lively [Wed, 10 Oct 2018 20:40:54 +0000 (20:40 +0000)]
[WebAssembly][NFC] Remove repetition of Defs = [ARGUMENTS]
Summary:
By moving that line into the `I` multiclass.
Reviewers: aheejin
Subscribers: dschuff, sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D53093
llvm-svn: 344180
Roman Lebedev [Wed, 10 Oct 2018 20:40:12 +0000 (20:40 +0000)]
[X86] Move X86DAGToDAGISel::matchBEXTRFromAnd() into X86ISelLowering
Summary:
As discussed in [[ https://bugs.llvm.org/show_bug.cgi?id=38938 | PR38938 ]],
we fail to emit `BEXTR` if the mask is shifted.
We can't deal with that in `X86DAGToDAGISel` `before the address mode for the inc is selected`,
and we can't really do it in the normal DAGCombine, because we don't have generic `ISD::BitFieldExtract` node,
and if we simply turn the shifted mask into a normal mask + shift-left, it will be folded back.
So it would seem X86ISelLowering is the place to handle this.
This patch only moves the matchBEXTRFromAnd()
from X86DAGToDAGISel to X86ISelLowering.
It does not add support for the 'shifted mask' pattern.
Reviewers: RKSimon, craig.topper, spatel
Reviewed By: RKSimon
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D52426
llvm-svn: 344179
Sanjay Patel [Wed, 10 Oct 2018 20:39:39 +0000 (20:39 +0000)]
revert r344082: [InstCombine] reverse 'trunc X to <N x i1>' canonicalization
This commit accidentally included the diffs from D53057.
llvm-svn: 344178
Rui Ueyama [Wed, 10 Oct 2018 20:29:29 +0000 (20:29 +0000)]
Eliminate dependency to formatv(). NFC.
llvm-svn: 344177
David Bolvansky [Wed, 10 Oct 2018 20:10:37 +0000 (20:10 +0000)]
[DwarfVerifier] Fixed -Wimplicit-fallthrough warning
Reviewers: JDevlieghere, RKSimon
Reviewed By: JDevlieghere
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D52963
llvm-svn: 344176
Thomas Lively [Wed, 10 Oct 2018 19:09:16 +0000 (19:09 +0000)]
[WebAssembly][NFC] Use vnot patfrag to simplify v128.not
Reviewers: aheejin, dschuff
Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D53097
llvm-svn: 344175
Kostya Serebryany [Wed, 10 Oct 2018 18:56:31 +0000 (18:56 +0000)]
[hwasan] print all threads in a bug report
llvm-svn: 344174
Zachary Turner [Wed, 10 Oct 2018 18:52:37 +0000 (18:52 +0000)]
[SymbolFileNativePDB] Fix compilation errors with gcc.
llvm-svn: 344173
Renato Golin [Wed, 10 Oct 2018 18:49:49 +0000 (18:49 +0000)]
[LV] Add a new reduction pattern match
Adding a new reduction pattern match for vectorizing code similar to TSVC s3111:
for (int i = 0; i < N; i++)
if (a[i] > b)
sum += a[i];
This patch adds support for fadd, fsub and fmull, as well as multiple
branches and different (but compatible) instructions (ex. add+sub) in
different branches.
I have forwarded to trunk, added fsub and fmul functionality and
additional tests, but the credit goes to Takahiro, who did most of the
actual work.
Differential Revision: https://reviews.llvm.org/D49168
Patch by Takahiro Miyoshi <takahiro.miyoshi@linaro.org>.
llvm-svn: 344172
Francis Visoiu Mistrih [Wed, 10 Oct 2018 18:43:42 +0000 (18:43 +0000)]
Reland: [OptRemarks] Add library for parsing optimization remarks
Add a library that parses optimization remarks (currently YAML, so based
on the YAMLParser).
The goal is to be able to provide tools a remark parser that is not
completely dependent on YAML, in case we decide to change the format
later.
It exposes a C API which takes a handler that is called with the remark
structure.
It adds a libLLVMOptRemark.a static library, and it's used in-tree by
the llvm-opt-report tool (from which the parser has been mostly moved
out).
Differential Revision: https://reviews.llvm.org/D52776
Fixed the tests by removing the usage of C++11 strings, which seems not
to be supported by gcc 4.8.4 if they're used as a macro argument.
llvm-svn: 344171
Kostya Serebryany [Wed, 10 Oct 2018 18:32:31 +0000 (18:32 +0000)]
[hwasan] print more tags around the buggy address, and do it with a single Printf
llvm-svn: 344169
Aaron Smith [Wed, 10 Oct 2018 18:30:32 +0000 (18:30 +0000)]
[Windows] Fix a bug that causes lldb to freeze
Summary:
If the process exits before any initial stop then notify the debugger
of the error otherwise WaitForDebuggerConnection() will be blocked.
An example of this issue is when a process fails to load a dependent DLL.
In addition to the fix, remove a duplicate call to FreeProcessHandles() in
DebuggerThread::HandleExitProcessEvent() and use decimal format
for all thread IDs.
Reviewers: rnk, zturner, aleksandr.urakov
Reviewed By: zturner
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D53090
llvm-svn: 344168
Eric Fiselier [Wed, 10 Oct 2018 18:22:23 +0000 (18:22 +0000)]
Add test macros for always_inline and noinline
llvm-svn: 344167
Scott Linder [Wed, 10 Oct 2018 18:14:02 +0000 (18:14 +0000)]
[Support] Remove redundant qualifiers in YAMLTraits (NFC)
llvm-svn: 344166
Francis Visoiu Mistrih [Wed, 10 Oct 2018 18:07:44 +0000 (18:07 +0000)]
Revert "[OptRemarks] Add library for parsing optimization remarks"
This reverts commit
1cc98e6672b6319fdb00b70dd4474aabdadbe193.
Seems to break bots: http://lab.llvm.org:8011/builders/clang-x86_64-linux-abi-test/builds/33398/steps/build-unified-tree/logs/stdio
llvm-svn: 344164
Volkan Keles [Wed, 10 Oct 2018 18:01:48 +0000 (18:01 +0000)]
[GlobalISel] Fix the artifact combiner to fold G_IMPLICIT_DEF properly
Summary:
GlobalISel generates incorrect code because the legalizer artifact
combiner assumes `G_[SZ]EXT (G_IMPLICIT_DEF)` is equivalent to
`G_IMPLICIT_DEF `.
Replace `G_[SZ]EXT (G_IMPLICIT_DEF)` with 0 because the top bits
will be 0 for G_ZEXT and 0/1 for the G_SEXT.
Reviewers: aditya_nandakumar, dsanders, aemerson, javed.absar
Reviewed By: aditya_nandakumar
Subscribers: rovka, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D52996
llvm-svn: 344163
Francis Visoiu Mistrih [Wed, 10 Oct 2018 17:58:09 +0000 (17:58 +0000)]
[OptRemarks] Add library for parsing optimization remarks
Add a library that parses optimization remarks (currently YAML, so based
on the YAMLParser).
The goal is to be able to provide tools a remark parser that is not
completely dependent on YAML, in case we decide to change the format
later.
It exposes a C API which takes a handler that is called with the remark
structure.
It adds a libLLVMOptRemark.a static library, and it's used in-tree by
the llvm-opt-report tool (from which the parser has been mostly moved
out).
Differential Revision: https://reviews.llvm.org/D52776
llvm-svn: 344162
Renato Golin [Wed, 10 Oct 2018 17:55:21 +0000 (17:55 +0000)]
[VPlan] Fix CondBit quoting in dumpBasicBlock
Quotes were being printed for VPInstructions but not the rest.
llvm-svn: 344161
Eric Fiselier [Wed, 10 Oct 2018 17:46:20 +0000 (17:46 +0000)]
Fix linking filesystem benchmarks
llvm-svn: 344160
Louis Dionne [Wed, 10 Oct 2018 17:37:37 +0000 (17:37 +0000)]
[clang] Fix failing attribute test on Windows
The test added in r344146 was failing because the ABI on Windows is
different, and that test includes ABI-specific details. The test now
harcodes which ABI to use so we can rely on those details.
llvm-svn: 344159
Craig Topper [Wed, 10 Oct 2018 17:37:32 +0000 (17:37 +0000)]
Change the timestamp of llvmcache-foo file to meet the thinLTO prune policy
The case will randomly fail if we test it with command "
while llvm-lit test/tools/gold/X86/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.
Patch by Luo Yuanke.
Differential Revision: https://reviews.llvm.org/D52452
llvm-svn: 344158
Erik Pilkington [Wed, 10 Oct 2018 17:17:51 +0000 (17:17 +0000)]
[Sema] Fix a multiple definition bug with friends and templates
The problem was that MergeFunctionDecl sometimes needs the injected template
arguments of a FunctionTemplateDecl, but is called before adding the new
template to the redecl chain. This leads to multiple common pointers in the same
redecl chain, each with their own identical instantiation. Fix this by merging
the the common state before inserting the new template into the redecl chain.
rdar://
44810129
Differential revision: https://reviews.llvm.org/D53046
llvm-svn: 344157
Marshall Clow [Wed, 10 Oct 2018 17:12:54 +0000 (17:12 +0000)]
Blind attempt to fix linker errors when building libc++abit w/o exceptions.
llvm-svn: 344156
Zachary Turner [Wed, 10 Oct 2018 16:39:07 +0000 (16:39 +0000)]
Create a SymbolFile plugin for cross-platform PDB access.
The existing SymbolFilePDB only works on Windows, as it is written
against a closed-source Microsoft SDK that ships with their debugging
tools.
There are several reasons we want to bypass this and go straight to the
bits of the PDB, but just to list a few:
More room for optimization. We can't see inside the implementation of
the Microsoft SDK, so we don't always know if we're doing things in the
most efficient way possible. For example, setting a breakpoint on main
of a big program currently takes several seconds. With the
implementation here, the time is unnoticeable.
We want to be able to symbolize Windows minidumps even if not on
Windows. Someone should be able to debug Windows minidumps as if they
were on Windows, given that no running process is necessary.
This patch is a very crude first attempt at filling out some of the
basic pieces.
I've implemented FindFunctions, ParseCompileUnitLineTable, and
ResolveSymbolContext for a limited subset of possible parameter values,
which is just enough to get it to display something nice for the
breakpoint location.
I've added several tests exercising this functionality which are limited
enough to work on all platforms but still exercise this functionality.
I'll try to add as many tests of this nature as I can, but at some
point we'll need a live process.
For now, this plugin is enabled always on non-Windows, and by setting
the environment variable LLDB_USE_NATIVE_PDB_READER=1 on Windows.
Eventually, once it's at parity with the Windows implementation, we'll
delete the Windows DIA-based implementation.
Differential Revision: https://reviews.llvm.org/D53002
llvm-svn: 344154
Scott Linder [Wed, 10 Oct 2018 16:35:47 +0000 (16:35 +0000)]
Relax trivial cast requirements in CallPromotionUtils
Differential Revision: https://reviews.llvm.org/D52792
llvm-svn: 344153