Commit Graph

300946 Commits

Author SHA1 Message Date
Michal Gorny c37d16140a [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
2018-10-11 11:58:07 +00:00
David Green 8066198442 [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
2018-10-11 11:28:27 +00:00
Alex Bradbury 686ef92141 [RISCV] Re-generate test/CodeGen/RISCV/vararg.ll after r344142
The improved load-store forwarding committed in r344142 broke this test.

llvm-svn: 344238
2018-10-11 11:11:58 +00:00
David Green 30c0e98b9c [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
2018-10-11 11:04:09 +00:00
David Green 64151bdea0 [InstCombine] Add tests for demand bits of min/max. NFC.
llvm-svn: 344236
2018-10-11 10:46:12 +00:00
Andrea Di Biagio f455e3569f [tblgen][CodeGenSchedule] Add a check for invalid RegisterFile definitions with zero physical registers.
llvm-svn: 344235
2018-10-11 10:39:03 +00:00
Hans Wennborg fe4bfe80ff 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
2018-10-11 10:04:15 +00:00
Florian Hahn 18e07bb822 [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
2018-10-11 09:46:25 +00:00
Florian Hahn 7eb5cb4ebc [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
2018-10-11 09:27:24 +00:00
Roman Lebedev d32c0d1466 [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
2018-10-11 09:09:52 +00:00
Roman Lebedev dd403575a2 [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
2018-10-11 09:09:50 +00:00
Calixte Denizet 589fff9c71 [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
2018-10-11 08:53:55 +00:00
Calixte Denizet d2f290b034 [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
2018-10-11 08:53:43 +00:00
Max Kazantsev 5dbeff3e1c [NFC] Factor out getOrCreateAddRecExpr method
llvm-svn: 344227
2018-10-11 08:46:39 +00:00
George Rimar 3368643f5e [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
2018-10-11 08:25:35 +00:00
Chandler Carruth d966ce4c98 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
2018-10-11 08:05:10 +00:00
Roman Lebedev 4225f4adff [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
2018-10-11 07:51:13 +00:00
Max Kazantsev b2e51090a4 [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
2018-10-11 07:22:26 +00:00
Martin Storsjo 5239041338 [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
2018-10-11 06:53:38 +00:00
Marshall Clow b198e58f67 Add a test that shows what happens with throwing destructors. NFC.
llvm-svn: 344220
2018-10-11 04:07:20 +00:00
Chris Bieneman fcfd434d43 [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
2018-10-11 04:06:14 +00:00
Chris Bieneman 3a389bd4c8 [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
2018-10-11 04:02:53 +00:00
Chris Bieneman 9a10eac663 [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
2018-10-11 04:00:51 +00:00
Zachary Turner 1bb9c85821 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
2018-10-11 03:42:17 +00:00
Eric Fiselier 426ec26028 Use C++03 friendly version of alignof
llvm-svn: 344215
2018-10-11 03:01:14 +00:00
Eric Fiselier 33e402ae2b 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
2018-10-11 01:48:00 +00:00
Kostya Serebryany 3d3d9d69fb [hwasan] extend the stack-uar test
llvm-svn: 344213
2018-10-11 01:05:18 +00:00
Fangrui Song a535e0543f Eliminate dependency to formatv(). NFC.
llvm-svn: 344212
2018-10-11 00:58:00 +00:00
Thomas Lively 7fa7e6a284 [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
2018-10-11 00:49:24 +00:00
Kostya Serebryany dac7b2abaf [hwasan] more compact printing for 'Previosly allocated frames'
llvm-svn: 344210
2018-10-11 00:34:20 +00:00
Jason Molenda 32762fd29d 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
2018-10-11 00:28:35 +00:00
Eric Fiselier 51fbb2e70a Update libc++abi's detection of aligned allocation after r344207.
llvm-svn: 344208
2018-10-11 00:18:54 +00:00
Eric Fiselier 42f9868cd8 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
2018-10-11 00:17:24 +00:00
Fangrui Song f953ea5fb6 [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
2018-10-11 00:08:59 +00:00
Thomas Lively 07ce6df879 [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
2018-10-11 00:07:55 +00:00
Thomas Lively 2ebacb107b [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
2018-10-11 00:01:25 +00:00
Kostya Serebryany 7b2b0185ba [hwasan] simplify a test
llvm-svn: 344203
2018-10-10 23:57:38 +00:00
Saleem Abdulrasool 0d1cbcc3eb 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
2018-10-10 23:53:12 +00:00
Richard Smith cee53ce4f2 Update documentation to indicate that profile remapping support is only
implemented for the new pass manager so far.

llvm-svn: 344201
2018-10-10 23:33:18 +00:00
Richard Smith 6c67662816 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
2018-10-10 23:13:47 +00:00
Richard Smith 8654ae52b0 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
2018-10-10 23:13:35 +00:00
Warren Ristow febfc4e89b [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
2018-10-10 22:54:31 +00:00
Nick Desaulniers 335315697a [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
2018-10-10 22:52:32 +00:00
Rui Ueyama 3c4344810a Make a member function private and rename it to avoid function overloading.
llvm-svn: 344196
2018-10-10 22:49:29 +00:00
Fangrui Song 11ca54f49c [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
2018-10-10 22:48:57 +00:00
Aaron Puchert 81d381bd7b 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
2018-10-10 22:35:24 +00:00
Kostya Serebryany d7c60e42e3 [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
2018-10-10 22:24:44 +00:00
Aaron Puchert 0e192395f1 Use std::scoped_lock only for C++17 and newer
This fixes a test failure caused by D53049.

llvm-svn: 344192
2018-10-10 22:05:33 +00:00
Louis Dionne 336db68378 [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
2018-10-10 22:00:58 +00:00
Reid Kleckner a52d151f9d [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
2018-10-10 21:59:56 +00:00