Zachary Turner [Fri, 11 Jan 2019 18:35:58 +0000 (18:35 +0000)]
Fix build breaks after the ParseCompileUnit changes.
The addition of SymbolFileBreakpad crossed paths with my change,
so this interface needs to be fixed up as well.
llvm-svn: 350950
Teresa Johnson [Fri, 11 Jan 2019 18:32:07 +0000 (18:32 +0000)]
[LTO] Add option to enable LTOUnit splitting, and disable unless needed
Summary:
Adds a new -f[no]split-lto-unit flag that is disabled by default to
control module splitting during ThinLTO. It is automatically enabled
for -fsanitize=cfi and -fwhole-program-vtables.
The new EnableSplitLTOUnit codegen flag is passed down to llvm
via a new module flag of the same name.
Depends on D53890.
Reviewers: pcc
Subscribers: ormris, mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, cfe-commits, llvm-commits
Differential Revision: https://reviews.llvm.org/D53891
llvm-svn: 350949
Teresa Johnson [Fri, 11 Jan 2019 18:31:57 +0000 (18:31 +0000)]
[LTO] Record whether LTOUnit splitting is enabled in index
Summary:
Records in the module summary index whether the bitcode was compiled
with the option necessary to enable splitting the LTO unit
(e.g. -fsanitize=cfi, -fwhole-program-vtables, or -fsplit-lto-unit).
The information is passed down to the ModuleSummaryIndex builder via a
new module flag "EnableSplitLTOUnit", which is propagated onto a flag
on the summary index.
This is then used during the LTO link to check whether all linked
summaries were built with the same value of this flag. If not, an error
is issued when we detect a situation requiring whole program visibility
of the class hierarchy. This is the case when both of the following
conditions are met:
1) We are performing LowerTypeTests or Whole Program Devirtualization.
2) There are type tests or type checked loads in the code.
Note I have also changed the ThinLTOBitcodeWriter to also gate the
module splitting on the value of this flag.
Reviewers: pcc
Subscribers: ormris, mehdi_amini, Prazek, inglorion, eraman, steven_wu, dexonsmith, arphaman, dang, llvm-commits
Differential Revision: https://reviews.llvm.org/D53890
llvm-svn: 350948
Pavel Labath [Fri, 11 Jan 2019 18:24:17 +0000 (18:24 +0000)]
Attempt to fix PDB tests broken by r350924
The patch added the symbol plugin name to the lldb-test output. Update
the tests to account for that.
llvm-svn: 350947
George Karpenkov [Fri, 11 Jan 2019 18:12:49 +0000 (18:12 +0000)]
[analyzer] [NFC] Fix the FIXME in tests
llvm-svn: 350946
Stefan Granitz [Fri, 11 Jan 2019 18:11:04 +0000 (18:11 +0000)]
[CMake] Include tests by default also in standalone builds
In-tree builds include tests by default. Standalone builds should behave the same.
llvm-svn: 350945
Jordan Rupprecht [Fri, 11 Jan 2019 18:06:31 +0000 (18:06 +0000)]
[llvm-objcopy][NFC] Consistenly use two dashes for flags in tests.
Summary:
As pointed out in D53667, our use of hyphens in flags can be inconsistent, mixing `-` with `--`. This change makes all long style flags use `--`.
Automatically changed via:
```
find test/tools/llvm-objcopy/ELF -type f | xargs sed -i 's/ -\([a-zA-Z]\{3\}\)/ --\1/g'
```
Two false positives were manually fixed/reverted.
Reviewers: jhenderson, espindola, alexshap
Reviewed By: jhenderson
Subscribers: emaste, javed.absar, arichardson, fedor.sergeev, jakehehrlich, llvm-commits
Differential Revision: https://reviews.llvm.org/D56513
llvm-svn: 350944
Zachary Turner [Fri, 11 Jan 2019 18:03:20 +0000 (18:03 +0000)]
[SymbolFile] Make ParseCompileUnitXXX accept a CompileUnit&.
Previously all of these functions accepted a SymbolContext&.
While a CompileUnit is one member of a SymbolContext, there
are also many others, and by passing such a monolithic parameter
in this way it makes the requirements and assumptions of the
API unclear for both callers as well as implementors.
All these methods need is a CompileUnit. By limiting the
parameter type in this way, we simplify the code as well as
make it self-documenting for both implementers and users.
Differential Revision: https://reviews.llvm.org/D56564
llvm-svn: 350943
George Karpenkov [Fri, 11 Jan 2019 18:02:08 +0000 (18:02 +0000)]
[attributes] Extend os_returns_(not_?)_retained attributes to parameters
When applied to out-parameters, the attributes specify the expected lifetime of the written-into object.
Additionally, introduce OSReturnsRetainedOn(Non)Zero attributes, which
specify that an ownership transfer happens depending on a return code.
Differential Revision: https://reviews.llvm.org/D56292
llvm-svn: 350942
Erich Keane [Fri, 11 Jan 2019 18:01:40 +0000 (18:01 +0000)]
Fix a pair of Wfallthrough warnings in ScanfFormatString.
Change-Id: Ia73a34fdd93fc974224583505f9e6432493cb0da
llvm-svn: 350941
Dan Liew [Fri, 11 Jan 2019 17:59:52 +0000 (17:59 +0000)]
Provide storage for `true_type::value` and `false_type::value`.
Summary:
This fixes linker errors that occurs when the
`sanitizer_type_traits_test.cc` is built without optimizations.
The error occurs because the test tries to take a reference.
A possible workaround is to give the GTest macros take boolean rvalues
by doing something like:
```
ASSERT_TRUE(bool(is_same<uptr, uptr>::value));
```
However this only hides the problem. Unfortunately Using `constexpr`
won't fix the problem unless we are using C++17.
Reviewers: vitalybuka, kubamracek, george.karpenkov, yln
Subscribers: mgorny, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D56035
llvm-svn: 350940
Vedant Kumar [Fri, 11 Jan 2019 17:56:35 +0000 (17:56 +0000)]
[MergeFunc] Erase unused duplicate functions if they are discardable
MergeFunc only deletes unused duplicate functions if they have local
linkage, but it should be safe to relax this to any "discardable if
unused" linkage type.
Differential Revision: https://reviews.llvm.org/D56574
llvm-svn: 350939
Vedant Kumar [Fri, 11 Jan 2019 17:56:21 +0000 (17:56 +0000)]
[MergeFunc] Use Instruction::getFunction as a cleanup, NFC
llvm-svn: 350938
Stefan Granitz [Fri, 11 Jan 2019 17:51:33 +0000 (17:51 +0000)]
[CMake] Remove dead code and outdated comments
Summary: All of these changes are NOPs.
Reviewers: stella.stamenova, labath, JDevlieghere
Reviewed By: stella.stamenova
Subscribers: mgorny, lldb-commits, #lldb
Differential Revision: https://reviews.llvm.org/D56609
llvm-svn: 350937
Adhemerval Zanella [Fri, 11 Jan 2019 17:31:17 +0000 (17:31 +0000)]
[libcxx] Call __count_bool_true for bitset count
This patch aims to help clang with better information so it can inline
__bit_reference count function usage for both std::biset. Current clang
inliner can not infer that the passed typed will be used only to select
the optimized variant, it evaluates the type argument and type check as
a load plus compare (although later optimization phases correctly
optimized this out).
It is mainly to help llvm inliner to generate better code for std::bitset
count for aarch64. It helps on both runtime and code size, since if inline
decides that _VSTD::count should not be inlined the vectorization will
create both aligned and unaligned variants (which add both code size and
runtime costs)
llvm-svn: 350936
Matt Morehouse [Fri, 11 Jan 2019 17:26:11 +0000 (17:26 +0000)]
XFAIL getusershell.cc on Android.
Android does not implement [set|get|end]usershell().
llvm-svn: 350935
Chris Kennelly [Fri, 11 Jan 2019 17:09:22 +0000 (17:09 +0000)]
Implementation Feature Test Macros for P0722R3
Summary:
P1353R0, adopted in San Diego, specified an implementation feature test macro for destroying delete (P0722R3).
The implementation of the feature (https://reviews.llvm.org/rL315662) is not guarded behind a flag, so the macro is not conditional on language version.
Reviewers: rsmith
Reviewed By: rsmith
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D55741
llvm-svn: 350934
Bjorn Pettersson [Fri, 11 Jan 2019 16:53:45 +0000 (16:53 +0000)]
Silence -Wsign-compare in unittests
llvm-svn: 350933
James Y Knight [Fri, 11 Jan 2019 16:27:14 +0000 (16:27 +0000)]
Add an .arcconfig for the top of the git monorepo.
llvm-svn: 350932
Ehsan Amiri [Fri, 11 Jan 2019 15:52:57 +0000 (15:52 +0000)]
[Jump Threading] Unfold a select insn that feeds a switch via a phi node
Currently when a select has a constant value in one branch and the select feeds
a conditional branch (via a compare/ phi and compare) we unfold the select
statement. This results in threading the conditional branch later on. Similar
opportunity exists when a select (with a constant in one branch) feeds a
switch (via a phi node). The patch unfolds select under this condition.
A testcase is provided.
llvm-svn: 350931
Marshall Clow [Fri, 11 Jan 2019 15:45:56 +0000 (15:45 +0000)]
Don't use the form '2017y' in tests, since some gcc versions don't allow it
llvm-svn: 350930
Marshall Clow [Fri, 11 Jan 2019 15:12:04 +0000 (15:12 +0000)]
Implement the 'sys_time' portions of the C++20 calendaring stuff. Reviewed as D56494
llvm-svn: 350929
Sanjay Patel [Fri, 11 Jan 2019 14:27:59 +0000 (14:27 +0000)]
[x86] allow insert/extract when matching horizontal ops
Previously, we limited this transform to cases where the
extraction into the build vector happens from vectors of
the same type as the build vector, but that's not required.
There's a slight potential regression seen in the AVX512
result for phadd -- we're using the 256-bit flavor of the
instruction now even though the 128-bit subset is sufficient.
The same problem could already be seen in the AVX2 result.
Follow-up patches will attempt to narrow that back down.
llvm-svn: 350928
Martin Storsjo [Fri, 11 Jan 2019 14:13:04 +0000 (14:13 +0000)]
[llvm-objcopy] [COFF] Implmement --strip-unneeded and -x/--discard-all for symbols
Differential Revision: https://reviews.llvm.org/D56480
llvm-svn: 350927
Martin Storsjo [Fri, 11 Jan 2019 13:47:37 +0000 (13:47 +0000)]
[llvm-objcopy] [COFF] Fix writing object files without symbols/string table
Previously, this was broken - by setting PointerToSymbolTable to zero
but still actually writing the string table length, the object file
header was corrupted.
Differential Revision: https://reviews.llvm.org/D56584
llvm-svn: 350926
Dmitry Venikov [Fri, 11 Jan 2019 11:51:52 +0000 (11:51 +0000)]
[llvm-symbolizer] Add -exe, -e as aliases to -obj
Summary: Provides -exe, -e as aliases to -obj. Motivation: https://bugs.llvm.org/show_bug.cgi?id=40071
Reviewers: ruiu, rnk, fjricci, jhenderson
Reviewed By: jhenderson
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D56580
llvm-svn: 350925
Pavel Labath [Fri, 11 Jan 2019 11:17:51 +0000 (11:17 +0000)]
Introduce SymbolFileBreakpad and use it to fill symtab
Summary:
This commit adds the glue code necessary to integrate the
SymbolFileBreakpad into the plugin system. Most of the methods are
stubbed out. The only method implemented method is AddSymbols, which
parses the PUBLIC "section" of the breakpad "object file", and fills out
the Module's symtab.
To enable testing this, I've made two additional changes:
- dump Symtab from the SymbolVendor class. The symtab was already being
dumped as a part of the object file dump, but that happened before
symbol vendor kicked in, so it did not reflect any symbols added
there.
- add ability to explicitly specify the external symbol file in
lldb-test (so that the object file could be linked with the breakpad
symbol file). To make things simpler, I've changed lldb-test from
consuming multiple inputs (and dumping their symbols) to having it
just process a single file per invocation. This was not a problem
since everyone was using it that way already.
Reviewers: clayborg, zturner, lemo, markmentovai, amccarth
Subscribers: mgorny, lldb-commits
Differential Revision: https://reviews.llvm.org/D56173
llvm-svn: 350924
Pavel Labath [Fri, 11 Jan 2019 10:18:40 +0000 (10:18 +0000)]
ELF: Fix base address computation code for files generated by yaml2obj
The code was assuming that the elf file will have a PT_LOAD segment
starting from the first byte of the file. While this is true for files
generated by most linkers (it's a way of saving space), it is not a
requirement. And files not satisfying this constraint can still be
perfectly executable. yaml2obj is one of the tools which produces files
like this.
This patch relaxes the check in ObjectFileELF to take the address of the
first PT_LOAD segment as the base address of the object (instead of the
one with the offset 0). Since the PT_LOAD segments are supposed to be
sorted according to the VM address, this entry will also be the one with
the lowest VM address.
If we ever run into files which don't have the PT_LOAD segments sorted,
we can easily change this code to return the lowest VM address as the
base address (if that is the correct thing to do for these files).
llvm-svn: 350923
Miklos Vajna [Fri, 11 Jan 2019 07:59:47 +0000 (07:59 +0000)]
[clang-tidy] new check 'readability-redundant-preprocessor'
Finds potentially redundant preprocessor directives.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D54349
llvm-svn: 350922
Martin Storsjo [Fri, 11 Jan 2019 07:31:17 +0000 (07:31 +0000)]
Revert "[SelectionDAGBuilder] Refactor GetRegistersForValue. NFCI."
This reverts commit r350841, as it actually had functional changes
and broke compilation. See PR40290.
llvm-svn: 350921
Akira Hatanaka [Fri, 11 Jan 2019 07:06:38 +0000 (07:06 +0000)]
[Sema] Make canPassInRegisters return true if the CXXRecordDecl passed
to it is a trivial_abi class.
A class that has all of its copy and move constructors deleted can still
be passed or returned in registers if the class is annotated with
trivial_abi.
This fixes PR39683.
llvm-svn: 350920
David Carlier [Fri, 11 Jan 2019 05:53:09 +0000 (05:53 +0000)]
[Sanitizer] Intercept getusershell
- If entries are properly copied (there were a bug in FreeBSD implementation in earlier version), or list properly reset.
Reviewers: vitalybuka, krytarowski
Reviewed By: krytarowski
Differential Revision: https://reviews.llvm.org/D56562
llvm-svn: 350919
Craig Topper [Fri, 11 Jan 2019 05:44:56 +0000 (05:44 +0000)]
[X86] Change vXi1 extract_vector_elt lowering to be legal if the index is 0. Add DAG combine to turn scalar_to_vector+extract_vector_elt into extract_subvector.
We were lowering the last step extract_vector_elt to a bitcast+truncate. Change it to use an extract_vector_elt of index 0 instead. Add isel patterns to do the equivalent of what the bitcast would have done. Plus an isel pattern for an any_extend+extract to prevent some regressions.
Finally add a DAG combine to turn v1i1 scalar_to_vector+extract_vector_elt of 0 into an extract_subvector.
This fixes some of the regressions from D350800.
llvm-svn: 350918
Akira Hatanaka [Fri, 11 Jan 2019 04:57:34 +0000 (04:57 +0000)]
[Sema] If CheckPlaceholderExpr rewrites the initializer of an auto
variable during auto type deduction, use the rewritten initializer when
performing initialization of the variable.
This silences spurious -Warc-repeated-use-of-weak warnings that are
issued when the initializer uses a weak ObjC pointer.
Differential Revision: https://reviews.llvm.org/D55662
llvm-svn: 350917
Brian Gesiak [Fri, 11 Jan 2019 02:12:31 +0000 (02:12 +0000)]
Adapt to CXXMethodDecl::getThisType change (NFC)
Summary:
https://reviews.llvm.org/D56509 changed the API of the
CXXMethodDecl::getThisType method. Adapt to the change (and re-apply
clang-format) to fix the clang-tidy build.
llvm-svn: 350916
Richard Smith [Fri, 11 Jan 2019 01:59:33 +0000 (01:59 +0000)]
Remember to instantiate explicit template argument lists in a friend
function declaration.
We'd previously often just drop these on the floor, and friend
redeclaration matching would usually (but not always) figure out the
right redeclaration anyway.
Also, don't try to match a dependent friend function template
specialization to a template until instantiation, and don't forget to
reject qualified friend declarations in dependent contexts that don't
name an already-declared entity.
llvm-svn: 350915
Brian Gesiak [Fri, 11 Jan 2019 01:54:53 +0000 (01:54 +0000)]
[AST] Remove ASTContext from getThisType (NFC)
Summary:
https://reviews.llvm.org/D54862 removed the usages of `ASTContext&` from
within the `CXXMethodDecl::getThisType` method. Remove the parameter
altogether, as well as all usages of it. This does not result in any
functional change because the parameter was unused since
https://reviews.llvm.org/D54862.
Test Plan: check-clang
Reviewers: akyrtzi, mikael
Reviewed By: mikael
Subscribers: mehdi_amini, dexonsmith, cfe-commits
Differential Revision: https://reviews.llvm.org/D56509
llvm-svn: 350914
Richard Trieu [Fri, 11 Jan 2019 01:32:35 +0000 (01:32 +0000)]
Fix header issues.
Several headers would fail to compile if other headers were not previously
included. The usual issue is that a class is forward declared, but the
full definition is needed. The requirement for the definition is use of
isa/dyn_cast or calling functions of pointer-packed data types such as
DenseMap or PointerIntPair. Add missing includes to these headers.
SVals.h required an out-of-line method definition in the .cpp file to avoid
circular inclusion of headers with BasicValueFactory.h
llvm-svn: 350913
Aaron Ballman [Fri, 11 Jan 2019 00:13:57 +0000 (00:13 +0000)]
Add an explicit initializer to silence a -Wmissing-field-initializers diagnostic; NFC.
llvm-svn: 350912
Thomas Lively [Thu, 10 Jan 2019 23:49:00 +0000 (23:49 +0000)]
[WebAssembly] Add unimplemented-simd128 feature, gate builtins
Summary: Depends on D56501. Also adds a macro define
`__wasm_unimplemented_simd128__` for feature detection of
unimplemented SIMD builtins.
Reviewers: aheejin, dschuff
Subscribers: sbc100, jgravelle-google, sunfish, kristina, cfe-commits, rrwinterton
llvm-svn: 350909
Francis Visoiu Mistrih [Thu, 10 Jan 2019 23:46:31 +0000 (23:46 +0000)]
[llvm-objdump][MachO] Disable some invalid input tests
It causes some (but not all) bots to fail. I'll look into it tomorrow
morning. Remove the tests for now to make the bots green.
llvm-svn: 350908
Artem Dergachev [Thu, 10 Jan 2019 23:44:44 +0000 (23:44 +0000)]
[analyzer] pr38838, pr39976: Fix crash on diagnosing before implicit destructor.
We need to be able to emit the diagnostic at PreImplicitCall,
and the patch implements this functionality.
However, for now the need for emitting such diagnostics is not all that great:
it is only necessary to not crash when emitting a false positive due to an
unrelated issue of having dead symbol collection not working properly.
Coming up with a non-false-positive test seems impossible with the current
set of checkers, though it is likely to be needed for good things as well
in the future.
Differential Revision: https://reviews.llvm.org/D56042
rdar://problem/
46911462
llvm-svn: 350907
Heejin Ahn [Thu, 10 Jan 2019 23:12:07 +0000 (23:12 +0000)]
[WebAssembly] Fix stack pointer store check in RegStackify
Summary:
We now use __stack_pointer global and global.get/global.set instruction.
This fixes the checking routine for stack_pointer writes accordingly.
This also fixes the existing __stack_pointer test in reg-stackify.ll:
That test used to pass not because of __stack_pointer clashes but
because the function `stackpointer_callee` was not marked as `readnone`,
so it was assumed to possibly write to memory arbitraily, and
`global.set` instruction was marked as `mayStore` in the .td definition,
so they were identified as intervening writes. After we added `readnone`
to its attribute, this test fails without this patch.
Reviewers: dschuff, sunfish
Subscribers: jgravelle-google, sbc100, llvm-commits
Differential Revision: https://reviews.llvm.org/D56094
llvm-svn: 350906
Nico Weber [Thu, 10 Jan 2019 23:10:04 +0000 (23:10 +0000)]
gn build: Add a template for calling write_cmake_config.py
No behavior change.
Differential Revision: https://reviews.llvm.org/D56487
llvm-svn: 350905
Nico Weber [Thu, 10 Jan 2019 23:05:39 +0000 (23:05 +0000)]
gn build: Merge r350852
llvm-svn: 350904
Anton Korobeynikov [Thu, 10 Jan 2019 22:59:50 +0000 (22:59 +0000)]
[MSP430] Minor fixes/improvements for assembler/disassembler
* Teach AsmParser to recognize @rn in distination operand as 0(rn).
* Do not allow Disassembler decoding instructions that have size more
than a number of input bytes.
* Fix UB in MSP430MCCodeEmitter.
Patch by Kristina Bessonova!
Differential Revision: https://reviews.llvm.org/D56547
llvm-svn: 350903
Anton Korobeynikov [Thu, 10 Jan 2019 22:54:53 +0000 (22:54 +0000)]
[MSP430] Add missing instruction forms
* Add missing mm, [r|m]n, [r|m]p instruction forms.
* Fix bit16mc instruction.
Patch by Kristina Bessonova!
Differential Revision: https://reviews.llvm.org/D56546
llvm-svn: 350902
Thomas Lively [Thu, 10 Jan 2019 22:32:11 +0000 (22:32 +0000)]
[WebAssembly] Add unimplemented-simd128 subtarget feature
Summary:
This is a third attempt, but this time we have vetted it on Windows
first. The previous errors were due to an uninitialized class member.
Reviewers: aheejin
Subscribers: dschuff, sbc100, jgravelle-google, sunfish, jfb, llvm-commits
Differential Revision: https://reviews.llvm.org/D56560
llvm-svn: 350901
Sterling Augustine [Thu, 10 Jan 2019 22:25:58 +0000 (22:25 +0000)]
Properly support -shared-libgcc.
This revision was revied in D55016.
llvm-svn: 350900
Martin Storsjo [Thu, 10 Jan 2019 22:05:21 +0000 (22:05 +0000)]
[llvm-objcopy] [COFF] Fix a test matching pathnames for Windows. NFC.
llvm-svn: 350899
Martin Storsjo [Thu, 10 Jan 2019 21:59:41 +0000 (21:59 +0000)]
[llvm-objcopy] [COFF] Fix warnings abuilt missing field initialization. NFC.
llvm-svn: 350898
Peter Collingbourne [Thu, 10 Jan 2019 21:57:07 +0000 (21:57 +0000)]
gn build: Use "git rev-parse --git-dir" to discover the path to the .git directory.
This makes it compatible with worktrees.
Differential Revision: https://reviews.llvm.org/D56422
llvm-svn: 350897
Gerolf Hoflehner [Thu, 10 Jan 2019 21:53:13 +0000 (21:53 +0000)]
[MachineCombiner][NFC] Prevent dereferencing past-the-end object in an MRI container
llvm-svn: 350896
Alina Sbirlea [Thu, 10 Jan 2019 21:47:15 +0000 (21:47 +0000)]
[MemorySSA] Disable checkClobberSanity for SkipSelfWalker.
Sanity will fail for this, since we're exploring getting a clobber
further than the sanity check expects.
Ideally we need to teach the sanity check to differentiate between the
two walkers based on the SkipSelf bool in the query.
llvm-svn: 350895
Nico Weber [Thu, 10 Jan 2019 21:47:10 +0000 (21:47 +0000)]
gn build: Merge r350893
llvm-svn: 350894
Martin Storsjo [Thu, 10 Jan 2019 21:28:24 +0000 (21:28 +0000)]
[llvm-objcopy] [COFF] Add support for removing symbols
Differential Revision: https://reviews.llvm.org/D55881
llvm-svn: 350893
Aaron Ballman [Thu, 10 Jan 2019 21:22:28 +0000 (21:22 +0000)]
Update clang-tools-extra for r350891 from Clang.
llvm-svn: 350892
Aaron Ballman [Thu, 10 Jan 2019 21:22:13 +0000 (21:22 +0000)]
Correct the source range returned from preprocessor callbacks.
This adjusts the source range passed in to the preprocessor callbacks to only include the condition range itself, rather than all of the conditionally skipped tokens.
llvm-svn: 350891
Stephen Kelly [Thu, 10 Jan 2019 20:58:21 +0000 (20:58 +0000)]
NFC: Change case of identifiers
llvm-svn: 350890
Zachary Turner [Thu, 10 Jan 2019 20:57:50 +0000 (20:57 +0000)]
Change SymbolFile::ParseTypes to ParseTypesForCompileUnit.
The function SymbolFile::ParseTypes previously accepted a SymbolContext.
This makes it extremely difficult to implement faithfully, because you
have to account for all possible combinations of members being set in
the SymbolContext. On the other hand, no clients of this function
actually care about implementing this function to this strict of a
standard. AFAICT, there is actually only 1 client in the entire
codebase, and it is the function ParseAllDebugSymbols, which is itself
only called for testing purposes when dumping information. At this
call-site, the only field it sets is the CompileUnit, meaning that an
implementer of a SymbolFile need not worry about any examining or
handling any other fields which might be set.
By restricting this API to accept exactly a CompileUnit& and nothing
more, we can simplify the life of new SymbolFile plugin implementers by
making it clear exactly what the necessary and sufficient set of
functionality they need to implement is, while at the same time removing
some dead code that tried to handle other types of SymbolContext fields
that were never going to be set anyway.
Differential Revision: https://reviews.llvm.org/D56462
llvm-svn: 350889
Zachary Turner [Thu, 10 Jan 2019 20:57:32 +0000 (20:57 +0000)]
[NativePDB] Add support for parsing typedef records.
Typedefs are represented as S_UDT records in the globals stream. This
creates a strange situation where "types" are actually represented as
"symbols", so they need special handling.
In order to test this, we don't just use lldb and print out some
variables causing the AST to get created, because variables whose type
is a typedef will have debug info referencing the original type, not the
typedef. So we use lldb-test instead which will parse all debug info in
the entire file. This exposed some problems with lldb-test and the
native reader, mainly that certain types of obscure symbols which we can
find when iterating every single record would trigger crashes. These
have been fixed as well so that lldb-test can be used to test this
functionality.
Differential Revision: https://reviews.llvm.org/D56461
llvm-svn: 350888
Akira Hatanaka [Thu, 10 Jan 2019 20:12:16 +0000 (20:12 +0000)]
[Sema] Call CheckPlaceholderExpr to resolve typeof or decltype
placeholder expressions while an unevaluated context is still on the
expression evaluation context stack.
This prevents recordUseOfWeek from being called when a weak variable is
used as an operand of a decltype or a typeof expression and fixes
spurious -Warc-repeated-use-of-weak warnings.
rdar://problem/
45742525
Differential Revision: https://reviews.llvm.org/D55662
llvm-svn: 350887
Sanjoy Das [Thu, 10 Jan 2019 20:12:09 +0000 (20:12 +0000)]
Avoid use-after-free in ~LegacyRTDyldObjectLinkingLayer
Reviewers: lhames
Subscribers: mcrosier, jlebar, bixia, llvm-commits
Differential Revision: https://reviews.llvm.org/D56521
llvm-svn: 350886
Yaxun Liu [Thu, 10 Jan 2019 20:09:52 +0000 (20:09 +0000)]
[HIP] Use nul instead of /dev/null when running on windows
When clang is running on windows, /dev/null is not available. Use nul as empty input file instead.
Differential Revision: https://reviews.llvm.org/D56225
llvm-svn: 350885
Louis Dionne [Thu, 10 Jan 2019 20:06:11 +0000 (20:06 +0000)]
[libcxx] Reorganize tests since the application of P0602R4
Summary:
P0602R4 makes the special member functions of optional and variant
conditionally trivial based on the types in the optional/variant.
We already implemented that, but the tests were organized as if this
were a non-standard extension. This patch reorganizes the tests in a
way that makes more sense since this is not an extension anymore.
Reviewers: EricWF, mpark, mclow.lists
Subscribers: christof, jkorous, dexonsmith, libcxx-commits
Differential Revision: https://reviews.llvm.org/D54772
llvm-svn: 350884
Julian Lettner [Thu, 10 Jan 2019 20:04:33 +0000 (20:04 +0000)]
[TSan] Remove ignore_interceptors_accesses flag
Summary:
It has been superseded by the `ignore_noninstrumented_modules` flag and is no longer needed.
Also simplify a test that checks that `mmap_interceptor` respects ignore annotations (`thr->ignore_reads_and_writes `).
Relevant: https://reviews.llvm.org/rL269855
<rdar://problem/
46263073> Remove obsolete Apple-specific suppression option
Reviewers: dcoughlin, kubamracek, dvyukov, delcypher
Reviewed By: dvyukov
Subscribers: jfb, llvm-commits, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D55075
llvm-svn: 350883
Michal Gorny [Thu, 10 Jan 2019 19:56:57 +0000 (19:56 +0000)]
[sanitizer_common] Define __sanitizer_FILE on NetBSD
Differential Revision: https://reviews.llvm.org/D56109
llvm-svn: 350882
Michal Gorny [Thu, 10 Jan 2019 19:56:50 +0000 (19:56 +0000)]
[sanitizer_common] Remove support for tirpc/rpc/xdr.h
Remove the partial support for rpc/xdr.h from libtirpc. Since it is
an entirely external library, we ought to build it sanitized separately
and not attempt to intercept like the libc implementation. Besides,
the existing code for tirpc support was neither complete nor working.
Noted by @krytarowski.
Differential Revision: https://reviews.llvm.org/D47817
llvm-svn: 350881
Matt Davis [Thu, 10 Jan 2019 19:56:03 +0000 (19:56 +0000)]
[GVN] Update BlockRPONumber prior to use.
Summary:
The original patch addressed the use of BlockRPONumber by forcing a sequence point when accessing that map in a conditional. In short we found cases where that map was being accessed with blocks that had not yet been added to that structure. For context, I've kept the wall of text below, to what we are trying to fix, by always ensuring a updated BlockRPONumber.
== Backstory ==
I was investigating an ICE (segfault accessing a DenseMap item). This failure happened non-deterministically, with no apparent reason and only on a Windows build of LLVM (from October 2018).
After looking into the crashes (multiple core files) and running DynamoRio, the cores and DynamoRio (DR) log pointed to the same code in `GVN::performScalarPRE()`. The values in the map are unsigned integers, the keys are `llvm::BasicBlock*`. Our test case that triggered this warning and periodic crash is rather involved. But the problematic line looks to be:
GVN.cpp: Line 2197
```
if (BlockRPONumber[P] >= BlockRPONumber[CurrentBlock] &&
```
To test things out, I cooked up a patch that accessed the items in the map outside of the condition, by forcing a sequence point between accesses. DynamoRio stopped warning of the issue, and the test didn't seem to crash after 1000+ runs.
My investigation was on an older version of LLVM, (source from October this year). What it looks like was occurring is the following, and the assembly from the latest pull of llvm in December seems to confirm this might still be an issue; however, I have not witnessed the crash on more recent builds. Of course the asm in question is generated from the host compiler on that Windows box (not clang), but it hints that we might want to consider how we access the BlockRPONumber map in this conditional (line 2197, listed above). In any case, I don't think the host compiler is wrong, rather I think it is pointing out a possibly latent bug in llvm.
1) There is no sequence point for the `>=` operation.
2) A call to a `DenseMapBase::operator[]` can have the side effect of the map reallocating a larger store (more Buckets, via a call to `DenseMap::grow`).
3) It seems perfectly legal for a host compiler to generate assembly that stores the result of a call to `operator[]` on the stack (that's what my host compile of GVN.cpp is doing) . A second call to `operator[]` //might// encourage the map to 'grow' thus making any pointers to the map's store invalid. The `>=` compares the first and second values. If the first happens to be a pointer produced from operator[], it could be invalid when dereferenced at the time of comparison.
The assembly generated from the Window's host compiler does show the result of the first access to the map via `operator[]` produces a pointer to an unsigned int. And that pointer is being stored on the stack. If a second call to the map (which does occur) causes the map to grow, that address (on the stack) is now invalid.
Reviewers: t.p.northover, efriedma
Reviewed By: efriedma
Subscribers: efriedma, llvm-commits
Differential Revision: https://reviews.llvm.org/D55974
llvm-svn: 350880
Alina Sbirlea [Thu, 10 Jan 2019 19:29:04 +0000 (19:29 +0000)]
Use MemorySSA in LICM to do sinking and hoisting.
Summary:
Step 2 in using MemorySSA in LICM:
Use MemorySSA in LICM to do sinking and hoisting, all under "EnableMSSALoopDependency" flag.
Promotion is disabled.
Enable flag in LICM sink/hoist tests to test correctness of this change. Moved one test which
relied on promotion, in order to test all sinking tests.
Reviewers: sanjoy, davide, gberry, george.burgess.iv
Subscribers: llvm-commits, Prazek
Differential Revision: https://reviews.llvm.org/D40375
llvm-svn: 350879
Nick Desaulniers [Thu, 10 Jan 2019 19:26:35 +0000 (19:26 +0000)]
fixup: sphinx warning
Fixes the sphinx warning:
tools/clang/docs/DiagnosticsReference.rst:7889: WARNING: Title underline
too short.
That I just introduced in r350877.
llvm-svn: 350878
Nick Desaulniers [Thu, 10 Jan 2019 19:12:39 +0000 (19:12 +0000)]
[SemaCXX] add -Woverride-init alias to -Winitializer-overrides
Summary:
https://bugs.llvm.org/show_bug.cgi?id=40251
https://github.com/ClangBuiltLinux/linux/issues/307
Reviewers: rsmith
Reviewed By: rsmith
Subscribers: cfe-commits, nathanchance, srhines
Differential Revision: https://reviews.llvm.org/D56522
llvm-svn: 350877
Adrian Prantl [Thu, 10 Jan 2019 19:06:46 +0000 (19:06 +0000)]
lldbtest.py: try to fix a runtime exception
found on http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-matrix/32/consoleFull#
15046896708254eaf0-7326-4999-85b0-
388101f2d404
llvm-svn: 350876
Craig Topper [Thu, 10 Jan 2019 19:05:34 +0000 (19:05 +0000)]
[X86] Call SimplifyDemandedBits on conditions of X86ISD::SHRUNKBLEND
This extends to combineVSelectToShrunkBlend to be able to resimplify SHRUNKBLENDS that have already been created.
This should help some of the regressions from D56387
Differential Revision: https://reviews.llvm.org/D56421
llvm-svn: 350875
Nicolas Lesser [Thu, 10 Jan 2019 19:03:33 +0000 (19:03 +0000)]
Fix false positive unsequenced access and modification warning in array subscript expression.
Summary: In the [expr.sub] p1, we can read that for a given E1[E2], E1 is sequenced before E2.
Patch by Mateusz Janek.
Reviewers: rsmith, Rakete1111
Reviewed By: rsmith, Rakete1111
Subscribers: riccibruno, lebedev.ri, Rakete1111, hiraditya, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D50766
llvm-svn: 350874
Craig Topper [Thu, 10 Jan 2019 19:02:14 +0000 (19:02 +0000)]
[X86] Simplify the BRCOND handling for FCMP_UNE.
Despite what the comment says, FCMP_UNE would be an OR not an AND. In the lowering code the first branch created still goes to the original destination. The second branch was exchanged to go to where the subsequent unconditional branch went. This is different than what we do for FCMP_OEQ where both branches that we create go to the original unconditional branch.
As far as I can tell, I think this means we don't need to exchange the branch target with the unconditional branch for FCMP_UNE at all.
Differential Revision: https://reviews.llvm.org/D56309
llvm-svn: 350873
JF Bastien [Thu, 10 Jan 2019 18:50:34 +0000 (18:50 +0000)]
Filesystem tests: fix fs.op.relative
Summary: The test wasn't using the testing infrastructure properly.
Reviewers: ldionne, mclow.lists, EricWF
Subscribers: christof, jkorous, dexonsmith, libcxx-commits
Differential Revision: https://reviews.llvm.org/D56519
llvm-svn: 350872
Francis Visoiu Mistrih [Thu, 10 Jan 2019 18:32:30 +0000 (18:32 +0000)]
[llvm-objdump][MachO] Fix test to work on Windows
This fails in http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/3208/steps/stage%201%20check/logs/stdio.
llvm-svn: 350871
George Karpenkov [Thu, 10 Jan 2019 18:28:10 +0000 (18:28 +0000)]
[analyzer] [hotfix] Fix the tests
The error must have crept during the cherry-pick.
llvm-svn: 350870
George Karpenkov [Thu, 10 Jan 2019 18:16:25 +0000 (18:16 +0000)]
[analyzer] Update the category name for RetainCountChecker reports
..now that it includes OSObjects
rdar://
46509986
Differential Revision: https://reviews.llvm.org/D56404
llvm-svn: 350869
George Karpenkov [Thu, 10 Jan 2019 18:16:10 +0000 (18:16 +0000)]
[analyzer] [NFC] [RetainCountChecker] Remove dead unused map
Differential Revision: https://reviews.llvm.org/D56402
llvm-svn: 350868
George Karpenkov [Thu, 10 Jan 2019 18:15:57 +0000 (18:15 +0000)]
[analyzer] Quote the type of the leaked/problematic object in diagnostics for readability
Differential Revision: https://reviews.llvm.org/D56344
llvm-svn: 350867
George Karpenkov [Thu, 10 Jan 2019 18:15:44 +0000 (18:15 +0000)]
[analyzer] [NFC] Reverse the argument order for "diff" in tests
The current argument order has "expected" and "actual" the wrong way around,
so that the diff shows the change from expected to actual, not from actual to expected.
Namely, if the expected diagnostics contains the string "foo", but the analyzer emits "bar",
we really want to see:
```
- foo
+ bar
```
not
```
- bar
+ foo
```
since adapting to most changes would require applying that diff to the expected output.
Differential Revision: https://reviews.llvm.org/D56340
llvm-svn: 350866
George Karpenkov [Thu, 10 Jan 2019 18:15:30 +0000 (18:15 +0000)]
[analyzer] [NFC] Reduce redundancy in RetainSummaryManager by using a function
Differential Revision: https://reviews.llvm.org/D56282
llvm-svn: 350865
George Karpenkov [Thu, 10 Jan 2019 18:15:17 +0000 (18:15 +0000)]
[analyzer] [RetainCountChecker] [NFC] Remove SummaryLog
The complicated machinery for passing the summary log around is actually
only used for one thing! To figure out whether the "dealloc" message was
sent.
Since I have tried to extend it for other uses and failed (it's actually
very hard to use), I think it's much better to simply use a tag and
remove the summary log altogether.
Differential Revision: https://reviews.llvm.org/D56228
llvm-svn: 350864
George Karpenkov [Thu, 10 Jan 2019 18:15:04 +0000 (18:15 +0000)]
[analyzer] [RetainCountChecker] [NFC] Another minor cleanup
Differential Revision: https://reviews.llvm.org/D56224
llvm-svn: 350863
George Karpenkov [Thu, 10 Jan 2019 18:14:51 +0000 (18:14 +0000)]
[analyzer] [RetainCountChecker] [NFC] Refactor the way attributes are handled
Make sure all checks for attributes go through a centralized function,
which checks whether attribute handling is enabled, and performs
validation. The type of the attribute is returned.
Sadly, metaprogramming is required as attributes have no sensible static
getters.
Differential Revision: https://reviews.llvm.org/D56222
llvm-svn: 350862
George Karpenkov [Thu, 10 Jan 2019 18:14:38 +0000 (18:14 +0000)]
[analyzer] [RetainCountChecker] Remove redundant enum UnarySummaryKind
Differential Revision: https://reviews.llvm.org/D56072
llvm-svn: 350861
George Karpenkov [Thu, 10 Jan 2019 18:14:25 +0000 (18:14 +0000)]
[analyzer] [RetainCountChecker] Remove obsolete "MakeCollectable" enum value
Differential Revision: https://reviews.llvm.org/D56071
llvm-svn: 350860
George Karpenkov [Thu, 10 Jan 2019 18:14:12 +0000 (18:14 +0000)]
[analyzer] [RetainCountChecker] [NFC] Remove redundant enum items *Msg, as the object type is already communicated by a separate field
Differential Revision: https://reviews.llvm.org/D56070
llvm-svn: 350859
George Karpenkov [Thu, 10 Jan 2019 18:13:59 +0000 (18:13 +0000)]
[analyzer] [NFC] Track object type with ArgEffect in RetainCountChecker.
This would be needed in the future.
https://reviews.llvm.org/D56040
llvm-svn: 350858
George Karpenkov [Thu, 10 Jan 2019 18:13:46 +0000 (18:13 +0000)]
[analyzer] [NFC] Move ObjKind into a separate top-level enum in RetainSummaryManager.
Allows using it in future outside of RetEffect.
Differential Revision: https://reviews.llvm.org/D56039
llvm-svn: 350857
Erik Pilkington [Thu, 10 Jan 2019 18:03:07 +0000 (18:03 +0000)]
Split -Wdelete-non-virtual-dtor into two groups
This group controls two diagnostics: deleting an abstract class with
a non-virtual dtor, which is a guaranteed crash, and deleting a
non-abstract polymorphic class with a non-virtual dtor, which is just
suspicious.
rdar://
40380564
Differential revision: https://reviews.llvm.org/D56405
llvm-svn: 350856
Rui Ueyama [Thu, 10 Jan 2019 17:57:30 +0000 (17:57 +0000)]
Remove an external test file. NFC.
llvm-svn: 350855
Dan Liew [Thu, 10 Jan 2019 17:47:44 +0000 (17:47 +0000)]
[lit] Make it possible for the lit test suite to pass with
`FILECHECK_OPTS=-v` set in the environment.
Follow up to r350850 as requested by Joel E. Denny in
https://reviews.llvm.org/D56541 .
llvm-svn: 350854
Rui Ueyama [Thu, 10 Jan 2019 17:45:56 +0000 (17:45 +0000)]
TrapInstr must be 4 bytes long. Currently we write two zeros on every two bytes.
llvm-svn: 350853
Rafael Stahl [Thu, 10 Jan 2019 17:44:04 +0000 (17:44 +0000)]
[analyzer][CrossTU][NFC] Generalize to external definitions instead of external functions
Summary: This is just changing naming and documentation to be general about external definitions that can be imported for cross translation unit analysis. There is at least a plan to add VarDecls: D46421
Reviewers: NoQ, xazax.hun, martong, a.sidorin, george.karpenkov, serge-sans-paille
Reviewed By: xazax.hun, martong
Subscribers: mgorny, whisperity, baloghadamsoftware, szepet, rnkovacs, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, cfe-commits
Differential Revision: https://reviews.llvm.org/D56441
llvm-svn: 350852
Francis Visoiu Mistrih [Thu, 10 Jan 2019 17:36:54 +0000 (17:36 +0000)]
[llvm-objdump][MachO] Fix error reporting after r350848 and r350849
llvm-svn: 350851
Dan Liew [Thu, 10 Jan 2019 17:24:06 +0000 (17:24 +0000)]
[FileCheck] Don't propagate `FILECHECK_DUMP_INPUT_ON_FAILURE` and
`FILECHECK_OPTS` into environment for FileCheck tests.
Summary:
This fixes the following FileCheck tests:
* FileCheck/dump-input-enable.txt
* FileCheck/match-full-lines.txt
when `FILECHECK_DUMP_INPUT_ON_FAILURE` is set in the environment.
By default llvm-lit propagates `FILECHECK_DUMP_INPUT_ON_FAILURE` and
`FILECHECK_OPTS` from llvm-lit's environment into the test environment.
Unfortunately this can break FileCheck's tests because they expect that
these environment variables not to be set.
rdar://problem/
47176262
Reviewers: jdenny, probinson, george.karpenkov
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D56541
llvm-svn: 350850
Francis Visoiu Mistrih [Thu, 10 Jan 2019 17:16:42 +0000 (17:16 +0000)]
[llvm-objdump][MachO] Use the -dsym file name when reporting errors
Instead of using the binary filename.
llvm-svn: 350849