Commit Graph

298615 Commits

Author SHA1 Message Date
Shuai Wang ea85b52732 [clang-tidy] Handle unique owning smart pointers in ExprMutationAnalyzer
Summary:
For smart pointers like std::unique_ptr which uniquely owns the
underlying object, treat the mutation of the pointee as mutation of the
smart pointer itself.

This gives better behavior for cases like this:
```
void f(std::vector<std::unique_ptr<Foo>> v) { // undesirable analyze result of `v` as not mutated.
  for (auto& p : v) {
      p->mutate(); // only const member function `operator->` is invoked on `p`
  }
}
```

Reviewers: hokein, george.karpenkov

Subscribers: xazax.hun, a.sidorin, Szelethus, cfe-commits

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

llvm-svn: 341967
2018-09-11 17:33:12 +00:00
Josh Stone aca532f14d Test commit: remove trailing whitespace
llvm-svn: 341966
2018-09-11 17:28:43 +00:00
Matt Morehouse 40fbdd0c4f Revert "[SanitizerCoverage] Create comdat for global arrays."
This reverts r341951 due to bot breakage.

llvm-svn: 341965
2018-09-11 17:20:14 +00:00
Alexey Bataev 06b6e0f406 [OPENMP]Increment iterator when the loop is continued.
Summary:
Missed operation of the incrementing iterator when required just to
continue execution.

Reviewers: kkwli0, gtbercea, grokos

Subscribers: guansong, openmp-commits

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

llvm-svn: 341964
2018-09-11 17:16:26 +00:00
Mike Rice 58df1affed [clang-cl, PCH] Support for /Yc and /Yu without filename and #pragma hdrstop
With clang-cl, when the user specifies /Yc or /Yu without a filename
the compiler uses a #pragma hdrstop in the main source file to
determine the end of the PCH. If a header is specified with /Yc or
/Yu #pragma hdrstop has no effect.

The optional #pragma hdrstop filename argument is not yet supported.

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

llvm-svn: 341963
2018-09-11 17:10:44 +00:00
Craig Topper 12fd6bd4ad [InstCombine] Use dyn_cast instead of match(m_Constant). NFC
llvm-svn: 341962
2018-09-11 16:51:26 +00:00
Craig Topper a57bb61a3e [InstCombine] Support (mul (sext x), cst) --> (sext (mul x, cst')) and (mul (zext x), cst) --> (zext (mul x, cst')) for vectors constants.
Similar to D51236, but for mul instead of add.

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

llvm-svn: 341961
2018-09-11 16:51:24 +00:00
Jessica Paquette 49d190f6f8 [NFC] Fix typo in comment
Fore -> For

llvm-svn: 341960
2018-09-11 16:38:46 +00:00
Jessica Paquette 050d1ac4a6 [MachineOutliner][NFC] Factor out instruction mapping into its own function
Just some tidy-up. Pull the mapper stuff into `populateMapper`. This makes it
a bit easier to read what's going on in `runOnModule`.

llvm-svn: 341959
2018-09-11 16:33:46 +00:00
Jonas Toth 2253878a40 [ASTMatchers] add three matchers for dependent expressions
Summary:
The new matchers can be used to check if an expression is type-, value- or instantiation-dependent
in a templated context.
These matchers are used in a clang-tidy check and generally useful as the
problem of unresolved templates occurs more often in clang-tidy and they
provide an easy way to check for this issue.

Reviewers: aaron.ballman, alexfh, klimek

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 341958
2018-09-11 16:09:19 +00:00
Shafik Yaghmour e2da5c525e Remove undefined behavior around the use of StateType
rdar://problem/43530233

Patch by Shafik Yaghmour.

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

llvm-svn: 341957
2018-09-11 16:08:05 +00:00
Craig Topper d7362a3e5f [X86] Correct the one use check from r341915.
The one use check should be on the bitcast, not the input to the bitcast.

llvm-svn: 341956
2018-09-11 16:05:03 +00:00
Julie Hockett ac68cab9e1 Reland "Implement a (simple) Markdown generator"
Relanding with fixes to tests for the failing bots.

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

llvm-svn: 341955
2018-09-11 15:56:55 +00:00
Alexandros Lamprineas db18e972d7 [GVNHoist] Re-enable GVNHoist by default
Rebase rL340922 since https://bugs.llvm.org/show_bug.cgi?id=38807
has been fixed by rL341947.

llvm-svn: 341954
2018-09-11 15:55:45 +00:00
Roman Lebedev baf2628043 [DagCombine][NFC] Some more tests fo for X % C == 0 (UREM case) transform
For https://reviews.llvm.org/D50222

Patch by: hermord (Dmytro Shynkevych)!

llvm-svn: 341953
2018-09-11 15:34:26 +00:00
Simon Atanasyan 16c2311c59 [MIPS] Fix illegal type assert in single-float mode
An fp_to_sint node would be incorrectly lowered to a TruncIntFP node in
single-float mode. This would trigger an "Unexpected illegal type!"
assert.

Patch by Dan Ravensloft.

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

llvm-svn: 341952
2018-09-11 15:32:47 +00:00
Matt Morehouse eac270caf4 [SanitizerCoverage] Create comdat for global arrays.
Summary:
Place global arrays in comdat sections with their associated functions.
This makes sure they are stripped along with the functions they
reference, even on the BFD linker.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: eraman, hiraditya, llvm-commits

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

llvm-svn: 341951
2018-09-11 15:23:14 +00:00
Kadir Cetinkaya 873cae5ae7 [clangd] Add unittests for D51917
Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

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

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

llvm-svn: 341950
2018-09-11 15:12:10 +00:00
Kadir Cetinkaya 84774c3ae3 [CodeCompletion] Enable signature help when initializing class/struct/union members.
Summary:
Factors out member decleration gathering and uses it in parsing to call signature
help. Doesn't support signature help for base class constructors, the code was too
coupled with diagnostic handling, but still can be factored out but just needs
more afford.

Reviewers: sammccall, ilya-biryukov, ioeric

Reviewed By: ilya-biryukov

Subscribers: cfe-commits

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

llvm-svn: 341949
2018-09-11 15:02:18 +00:00
Rui Ueyama 98e4a5ca11 Simplify.
Instead of Map<StringRef, bool>, we can simply use Set<StringRef>.

llvm-svn: 341948
2018-09-11 14:37:27 +00:00
Alexandros Lamprineas 96762b37e1 [MemorySSAUpdater] Avoid creating self-referencing MemoryDefs
Fix for https://bugs.llvm.org/show_bug.cgi?id=38807, which occurred
while compiling SemaTemplateInstantiate.cpp with clang and GVNHoist
enabled. In the following example:

      1=def(entry)
      /        \
2=def(1)       4=def(1)
3=def(2)       5=def(4)

When removing the MemoryDef 2=def(1) from its basic block, and just
before adding it to the end of the parent basic block, we first
replace all its uses with the defining memory access:

3=def(2) -> 3=def(1)

Then we call insertDef for adding 2=def(1) to the parent basic block,
where we replace the uses of 1=def(entry) with 2=def(1). Doing so we
create a self reference:

2=def(1) -> 2=def(2)  (bad)
3=def(1) -> 3=def(2)  (ok)
4=def(1) -> 4=def(2)  (ok)

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

llvm-svn: 341947
2018-09-11 14:29:59 +00:00
Tobias Grosser 4beb2f964b [PerfMonitor] Fix rdtscp callsites
Summary:
Update all rdtscp callsites in PerfMonitor so that they conform with the signature changes introduced in r341698.

Reviewers: grosser, bollu

Subscribers: llvm-commits

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

llvm-svn: 341946
2018-09-11 14:17:44 +00:00
Nico Weber e2745b5d86 pdb output: Initialize padding in PublicsStreamHeader.
Makes the produced pdbs more deterministic; before they'd contain 2 arbitary
bytes where this padding was.

Also reorder initialization to match the order of the fields in the struct (nfc)

llvm-svn: 341945
2018-09-11 14:11:52 +00:00
Nico Weber f48e961d23 Make malformed-machos.test pass on my Mac.
For some reason, llvm-objdump defaults to -arch=i386 on this system while
the test checks x86_64 output. Explicitly pass -arch=x86_64.

llvm-svn: 341944
2018-09-11 14:10:33 +00:00
Roman Lebedev de9d787131 [Hexagon] [Test] Remove undef and infinite loop from test
Summary:
The undef and the infinite loop at the end cause this test to be translated
unpredictably. In particular, the checked-for `mpy` disappears under
certain legal optimizations (e.g. the one in D50222).
Since the use of these constructs is not relevant to the behavior tested,
according to the header comment, this change, suggested by @kparzysz,
eliminates them.

Was initially committed in r341046, but was reverted.

Patch by: hermord (Dmytro Shynkevych)!

Reviewers: kparzysz

Reviewed By: kparzysz

Subscribers: lebedev.ri, llvm-commits, kparzysz

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

llvm-svn: 341943
2018-09-11 14:06:14 +00:00
Aleksandr Urakov 35725c9894 [PDB] Fix problems after rL341782
Summary:
This commit fixes following problems after rL341782:
- Broken SymbolFilePDBTests
- Warning on comparison of integers of different signs

Tags: #lldb

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

llvm-svn: 341942
2018-09-11 14:03:12 +00:00
Sam Parker 01db2983cd [ARM] Add smlald support in ARMParallelDSP
Search from i64 reducing phis, as well as i32, to allow the
generation of smlald instructions.

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

llvm-svn: 341941
2018-09-11 14:01:22 +00:00
Raphael Isemann 262dd8c9df Print the correct error when our DynamicCheckerFunctions fail to install
Summary:
The check is inverted here: If we have error messages, we should print those instead
of our default error message. But currently we print the default message when we
actually have a sensible error to print.

Fixes https://bugs.llvm.org/show_bug.cgi?id=38383
Thanks Nat for the patch!

Reviewers: #lldb, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: JDevlieghere, lldb-commits

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

llvm-svn: 341940
2018-09-11 13:59:47 +00:00
Alexey Bataev 30a7821760 [OPENMP] Simplified checks for declarations in declare target regions.
Sema analysis should not mark functions as an implicit declare target,
it may break codegen. Simplified semantic analysis and removed extra
code for implicit declare target functions.

llvm-svn: 341939
2018-09-11 13:59:10 +00:00
Simon Pilgrim 008da027fc Remove unnecessary semicolon to silence -Wpedantic warning. NFCI.
llvm-svn: 341938
2018-09-11 13:42:15 +00:00
Rui Ueyama 10454c4fd5 Style fix.
llvm-svn: 341937
2018-09-11 13:41:58 +00:00
Sanjay Patel e368f46788 [AArch64] test codegen for unsigned saturated add; NFC
This is identical to the tests added for x86 at rL341845.
A semi-generic DAGCombine should improve things universally.

llvm-svn: 341935
2018-09-11 13:21:28 +00:00
Petar Jovanovic 5abf4bb552 [MIPS] ORC JIT support
This patch adds support for ORC JIT for mips/mips64 architecture.
In common code $static is changed to __ORCstatic because on MIPS
architecture "$" is a reserved character.

Patch by Luka Ercegovcevic

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

llvm-svn: 341934
2018-09-11 13:10:04 +00:00
Jonas Toth b88eebebbe [NFC][clangd] fix warning for extra semicolon
llvm-svn: 341933
2018-09-11 13:01:49 +00:00
Sam Parker 945604d511 [ARM] Enable ARMCodeGenPrepare by default
We've had the pass enabled downstream for a couple of weeks and it
seems to be okay, so enable it by default.

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

llvm-svn: 341932
2018-09-11 12:45:43 +00:00
Raphael Isemann b658f1df35 [NFC] Fix compiler warning in TestArmv7Disassembly.cpp
The warning is
    comparison of integers of different signs: 'const int' and 'const unsigned long'
and triggered by
    EXPECT_EQ (num_of_instructions, inst_list.GetSize());
as num_of_instructions is an int in this comparison (and the RHS is size_t).

llvm-svn: 341931
2018-09-11 12:45:22 +00:00
Jonathan Coe 5f5d3fa098 [python bindings] Expose getNumTemplateArguments
Expose the C bindings for clang_Type_getNumTemplateArguments() and
clang_Type_getTemplateArgumentAsType() in the python API.

Patch by kjteske (Kyle Teske).

Reviewed By: jbcoe

Subscribers: cfe-commits

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

llvm-svn: 341930
2018-09-11 12:44:52 +00:00
Benjamin Kramer 8f776db7ff [clang-tidy] Insert absl::StrAppend when replacing StrCat.
There might be no using decl for StrAppend around, inserting the
qualified name is less likely to break things.

llvm-svn: 341929
2018-09-11 12:19:45 +00:00
Alexander Timofeev db7ee7660a [AMDGPU] Preliminary patch for divergence driven instruction selection. Immediate selection predicate changed
Differential revision: https://reviews.llvm.org/D51734
Reviewers: rampitec

llvm-svn: 341928
2018-09-11 11:56:50 +00:00
Johannes Doerfert ae3cfeb3ad [FuncAttrs] Remove "access range attributes" for read-none functions
The presence of readnone and an access range attribute (argmemonly,
inaccessiblememonly, inaccessiblemem_or_argmemonly) is considered an
error by the verifier. This seems strict but also not wrong. This
patch makes sure function attribute detection will remove all access
range attributes for readnone functions.

llvm-svn: 341927
2018-09-11 11:51:29 +00:00
Johannes Doerfert a58e9214ac [LoopInfo] Fix Loop::getLoopID() for loops with multiple latches
The previous implementation traversed all loop blocks and bailed if one
was not a latch block. Since we are only interested in latch blocks, we
should only traverse those.

llvm-svn: 341926
2018-09-11 11:44:17 +00:00
Benjamin Kramer 4f3c0e27b6 [clang-tidy] Add a missing comma after "flags"
llvm-svn: 341925
2018-09-11 10:37:08 +00:00
David Carlier 395aa78986 [Msan] Fix unit test linkage issue on FreeBSD
Fix typical relocation linkage issue.

Reviwewers: dim, emaste

Reviewed By: krytarowski

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

llvm-svn: 341924
2018-09-11 10:35:32 +00:00
Kirill Bobyrev 0dee397e06 [clangd] NFC: Use uint32_t for FuzzyFindRequest limits
Reviewed By: ioeric

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

llvm-svn: 341921
2018-09-11 10:31:38 +00:00
Simon Atanasyan 32d8d1bf04 [mips] Add a pattern for 64-bit GPR variant of the `rdhwr` instruction
MIPS ISAs start to support third operand for the `rdhwr` instruction
starting from Revision 6. But LLVM generates assembler code with
three-operands version of this instruction on any MIPS64 ISA. The third
operand is always zero, so in case of direct code generation we get
correct code.

This patch fixes the bug by adding an instruction alias. The same alias
already exists for 32-bit ISA.

Ideally, we also need to reject three-operands version of the `rdhwr`
instruction in an assembler code if ISA revision is less than 6. That is
a task for a separate patch.

This fixes PR38861 (https://bugs.llvm.org/show_bug.cgi?id=38861)

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

llvm-svn: 341919
2018-09-11 09:57:25 +00:00
Max Kazantsev bf00f03f56 [NFC] Sanitizing asserts for OrderedBasicBlock
llvm-svn: 341917
2018-09-11 08:46:19 +00:00
Craig Topper 844f035e1e [X86] In combineMOVMSK, look through int->fp bitcasts before callling SimplifyDemandedBits.
MOVMSKPS and MOVMSKPD both take FP types, but likely the operations before it are on integer types with just a int->fp bitcast between them. If the bitcast isn't used by anything else and doesn't change the element width we can look through it to simplify the integer ops.

llvm-svn: 341915
2018-09-11 08:20:02 +00:00
Dean Michael Berris 174d2cf771 [XRay] Ensure lambda outlives llvm::function_ref
Follow-up to D51912.

llvm-svn: 341912
2018-09-11 08:03:30 +00:00
Ilya Biryukov 008eda0807 [Tooling] Restore working dir in ClangTool.
Summary:
And add an option to disable this behavior. The option is only used in
AllTUsExecutor to avoid races when running concurrently on multiple
threads.

This fixes PR38869 introduced by r340937.

Reviewers: ioeric, steveire

Reviewed By: ioeric

Subscribers: cfe-commits

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

llvm-svn: 341910
2018-09-11 07:29:09 +00:00
Dean Michael Berris ec605d3846 [XRay] Write the TSC along with CPUID
Fixes builds in non-little-endian systems.

This is a follow-up to D51911.

llvm-svn: 341909
2018-09-11 07:27:59 +00:00