Commit Graph

266900 Commits

Author SHA1 Message Date
Alex Lorenz 75ac75d01e Remove another 'using namespace llvm' from the
RecursiveSymbolVisitor.h header

This should fix the modules build
(http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules-2/).

llvm-svn: 307908
2017-07-13 12:49:22 +00:00
Siddharth Bhat a1b2086a33 [Invariant Loads] Do not consider invariant loads to have dependences.
We need to relax constraints on invariant loads so that they do not
create fake RAW dependences. So, we do not consider invariant loads as
scalar dependences in a region.

During these changes, it turned out that we do not consider `llvm::Value`
replacements correctly within `PPCGCodeGeneration` and `ISLNodeBuilder`.
The replacements dictated by `ValueMap` were not being followed in all
places. This was fixed in this commit. There is no clean way to decouple
this change because this bug only seems to arise when the relaxed
version of invariant load hoisting was enabled.

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

llvm-svn: 307907
2017-07-13 12:18:56 +00:00
Simon Dardis 250256f9c9 Reland "[mips] Fix multiprecision arithmetic."
For multiprecision arithmetic on MIPS, rather than using ISD::ADDE / ISD::ADDC,
get SelectionDAG to break down the operation into ISD::ADDs and ISD::SETCCs.

For MIPS, only the DSP ASE has a carry flag, so in the general case it is not
useful to directly support ISD::{ADDE, ADDC, SUBE, SUBC} nodes.

Also improve the generation code in such cases for targets with
TargetLoweringBase::ZeroOrOneBooleanContent by directly using the result of the
comparison node rather than using it in selects. Similarly for ISD::SUBE /
ISD::SUBC.

Address optimization breakage by moving the generation of MIPS specific integer
multiply-accumulate nodes to before legalization.

This revolves PR32713 and PR33424.

Thanks to Simonas Kazlauskas and Pirama Arumuga Nainar for reporting the issue!

Reviewers: slthakur

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

The previous version of this patch was too aggressive in producing fused
integer multiple-addition instructions.

llvm-svn: 307906
2017-07-13 11:28:05 +00:00
Alex Lorenz 10db8ce290 Remove 'using namespace llvm' from the USRFinder.h header
This should fix the modules build
(http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules-2/).

llvm-svn: 307905
2017-07-13 11:27:12 +00:00
Diana Picus c452175642 [ARM] GlobalISel: Support G_BR
This boils down to not crashing in reg bank select due to the lack of
register operands on this instruction, and adding some tests. The
instruction selection is already covered by the TableGen'erated code.

llvm-svn: 307904
2017-07-13 11:09:34 +00:00
Alex Lorenz 50b2dd336e [ObjC] Pick a 'readwrite' property when synthesizing ambiguous
property and check for incompatible attributes

This commit changes the way ambiguous property synthesis (i.e. when synthesizing
a property that's declared in multiple protocols) is performed. Previously,
Clang synthesized the first property that was found. This lead to problems when
the property was synthesized in a class that conformed to two protocols that
declared that property and a second protocols had a 'readwrite' declaration -
the setter was not synthesized so the class didn't really conform to the second
protocol and user's code would crash at runtime when they would try to set the
property.

This commit ensures that a first readwrite property is selected. This is a
semantic change that changes users code in this manner:

```
@protocol P @property(readonly) int p; @end
@protocol P2 @property(readwrite) id p; @end
@interface I <P2> @end
@implementation I
@syntesize p; // Users previously got a warning here, and Clang synthesized
              // readonly 'int p' here. Now Clang synthesizes readwrite 'id' p..
@end
```

To ensure that this change is safe, the warning about incompatible types is
promoted to an error when this kind of readonly/readwrite ambiguity is detected
in the @implementation. This will ensure that previous code that had this subtle
bug and ignored the warning now will fail to compile with an error, and users
should not get suprises at runtime once they resolve the error.

The commit also extends the ambiguity checker, and now it can detect conflicts
among the different property attributes. An error diagnostic is used for
conflicting attributes, to ensure that the user won't get "suprises" at runtime.

ProtocolPropertyMap is removed in favour of a a set + vector because the map's
order of iteration is non-deterministic, so it couldn't be used to select the
readwrite property.

rdar://31579994

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

llvm-svn: 307903
2017-07-13 11:06:22 +00:00
Florian Hahn 03c3a1adec [PM] Use range-based for loops in LegacyPassManager.cpp (NFC).
Summary:
This patch replaces a bunch of iterator-based for loops with range-based
for loops. There are 2 iterator-based loops left in this file in
removeNotPreservedAnalysis, but I think those cannot be replaced by
range-based for loops as they modify the container they are iterating
over.

Unless I missed something, this schould be a NFC and I would appreciate
if someone could have a quick look to confirm that.

Reviewers: chandlerc, pcc, jhenderson

Reviewed By: jhenderson

Subscribers: llvm-commits, mehdi_amini

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

llvm-svn: 307902
2017-07-13 10:52:00 +00:00
Alex Lorenz 9b9188d861 [index] Objective-C method declarations and message sends with
an empty first selector piece should store the location of the first ':'

rdar://33188656

llvm-svn: 307901
2017-07-13 10:50:21 +00:00
Simon Pilgrim bb85cb16e3 [DAGCombiner] Fix issue with rotate combines asserting if the constant value types differ from the result type.
llvm-svn: 307900
2017-07-13 10:41:49 +00:00
Jonas Hahnfeld 266ddafc68 [GOMP] Fix (un)tied tasks with the GCC
The first bit is actually the "untied" flag. That is why the condition was
wrong and has to be inverted to set the flag correctly.

Found and initial patch by Simon Convent!

llvm-svn: 307899
2017-07-13 10:38:11 +00:00
Alex Lorenz 98394f8393 [refactor][rename] Use a single base class for class that finds
a declaration at location and for class that searches for all occurrences of
a specific declaration

This commit uses a single RecursiveSymbolVisitor class for both
USRLocFindingASTVisitor and NamedDeclOccurrenceFindingVisitor to avoid duplicate
traversal code. It also traverses nested name specifier locs in the new class
and remove the separate matching step.

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

llvm-svn: 307898
2017-07-13 10:36:33 +00:00
Javed Absar d32f9c8190 [ARM] Tidy up and organise better ARM.td. NFC.
This patch tidies up and organises ARM.td
so that it is easier to understandand
and extend in the future.

Reviewed by: @hahn, @rovka
Differential Revision: https://reviews.llvm.org/D35248

llvm-svn: 307897
2017-07-13 10:24:30 +00:00
Diana Picus f69d7b0495 Fixup r307893: Silence warning
Silence unused variable warning in release builds.
*sigh*

llvm-svn: 307896
2017-07-13 09:52:06 +00:00
Simon Pilgrim 2dc42b7202 Use isNullConstantOrNullSplatConstant helper. NFCI.
llvm-svn: 307895
2017-07-13 09:39:00 +00:00
Simon Pilgrim 5ee68bcc22 Fix whitespace indentation. NFCI.
llvm-svn: 307894
2017-07-13 09:36:04 +00:00
Diana Picus 6860a60c07 [ARM] GlobalISel: Move local variable. NFC
Move a local variable from outside a switch to inside every case that
needs it (which isn't all of the cases, of course).

llvm-svn: 307893
2017-07-13 09:30:08 +00:00
Florian Hahn 738a70d54d [ARM] Fix typo in test added in r307889
This fixes the following test failure:
    LLVM :: Transforms/Inline/ARM/inline-target-attr.ll

Sorry for any inconenience.

llvm-svn: 307892
2017-07-13 08:53:43 +00:00
Dylan McKay 476a562715 [AVR] Fix broken indentation
llvm-svn: 307891
2017-07-13 08:40:59 +00:00
Dylan McKay fb22c187ee [AVR] Add a 'LLVM_FALLTHROUGH' statement to the AsmParser
Should fix warnings in the build.

llvm-svn: 307890
2017-07-13 08:39:46 +00:00
Florian Hahn 4adcfcf1d6 [ARM] Inline callee if its target-features are a subset of the caller
Summary:
Similar to X86, it should be safe to inline callees if their
target-features are a subset of the caller. As some subtarget features
provide different instructions depending on whether they are set or
unset (e.g. ThumbMode and ModeSoftFloat), we use a whitelist of
target-features describing hardware capabilities only.

Reviewers: kristof.beyls, rengolin, t.p.northover, SjoerdMeijer, peter.smith, silviu.baranga, efriedma

Reviewed By: SjoerdMeijer, efriedma

Subscribers: dschuff, efriedma, aemerson, sdardis, javed.absar, arichardson, eraman, llvm-commits

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

llvm-svn: 307889
2017-07-13 08:26:17 +00:00
Dylan McKay 9fb04071a2 [AVR] Fix indirect calls to function pointers
Patch by Carl Peto.

llvm-svn: 307888
2017-07-13 08:09:36 +00:00
Mikael Holmen 0c7d406bb2 Add original reproducer for r307754 / PR33689
Apparently I managed to drop the test case between two revisions in
Phabricator: https://reviews.llvm.org/D35003

llvm-svn: 307887
2017-07-13 07:38:53 +00:00
Hiroshi Inoue a5141c8d17 fix typos in comments; NFC
llvm-svn: 307886
2017-07-13 06:51:20 +00:00
Hiroshi Inoue e9dea6e613 fix typos in comments and error messges; NFC
llvm-svn: 307885
2017-07-13 06:48:39 +00:00
Craig Topper f3de5eb7c6 [X86] Simplify the getHostCPUName for AMD family 6 and 15.
As far as I can tell we can simply distinguish based on features rather than model number. Many of the strings we were previously using are treated the same by the backend.

llvm-svn: 307884
2017-07-13 06:34:10 +00:00
Akira Hatanaka 2246167362 [Sema] Mark a virtual CXXMethodDecl as used if a call to it can be
devirtualized.

The code to detect devirtualized calls is already in IRGen, so move the
code to lib/AST and make it a shared utility between Sema and IRGen.

This commit fixes a linkage error I was seeing when compiling the
following code:

$ cat test1.cpp
struct Base {
  virtual void operator()() {}
};

template<class T>
struct Derived final : Base {
  void operator()() override {}
};

Derived<int> *d;

int main() {
  if (d)
    (*d)();
  return 0;
}

rdar://problem/33195657

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

llvm-svn: 307883
2017-07-13 06:08:27 +00:00
Martin Storsjo fa5183b028 [llvm-objdump] Correctly distinguish between the MachO upper/lower16 relocations
All other code in MachODump.cpp uses the same comparison,
((r_length & 0x1) == 1), for distinguishing between the two,
while the code in llvm-objdump.cpp seemed to be incorrect.

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

llvm-svn: 307882
2017-07-13 05:54:08 +00:00
Kuba Mracek b244c2bafe Upstreaming a patch from Github: When evaluation user expressions, ignore InstrumentationRuntime breakpoints. (#235)
llvm-svn: 307881
2017-07-13 04:35:27 +00:00
Davide Italiano 7876f2d34c [opt-viewer] Don't except when debug info is not available.
For records without DebugLoc we simply skip the caller location in
map_remarks.

Fixes PR33764.

Patch by Simon Whittaker!

llvm-svn: 307880
2017-07-13 04:19:13 +00:00
Geoff Berry bea2e188e9 [TargetLowering] Add hook for adding target MMO flags when doing ISel.
Summary: Add TargetLowering hook getMMOFlags() to add target specific
MMO flags to load/store instructions created by ISel.

Reviewers: bogner, hfinkel, qcolombet, MatzeB

Subscribers: mcrosier, javed.absar, llvm-commits

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

llvm-svn: 307879
2017-07-13 03:49:42 +00:00
Craig Topper e6b07073ca [compiler-rt][X86] Match the detection of cpu's for __cpu_model to the latest version of gcc
Summary:
We were missing many feature flags that newer gcc supports and we had our own set of feature flags that gcc didnt' support that were overlapping. Clang's implementation assumes gcc's features list so a mismatch here is problematic.

I've also matched the cpu type/subtype lists with gcc and removed all the cpus that gcc doesn't support. I've also removed the fallback autodetection logic that was taken from Host.cpp. It was the main reason we had extra feature flags relative to gcc. I don't think gcc does this in libgcc.

Once this support is in place we can consider implementing __builtin_cpu_is in clang. This could also be needed for function dispatching that Erich Keane is working on.

Reviewers: echristo, asbirlea, RKSimon, erichkeane, zvi

Reviewed By: asbirlea

Subscribers: dberris, llvm-commits

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

llvm-svn: 307878
2017-07-13 02:56:24 +00:00
Geoff Berry 6748abe24d [MIR] Add support for printing and parsing target MMO flags
Summary: Add target hooks for printing and parsing target MMO flags.
Targets may override getSerializableMachineMemOperandTargetFlags() to
return a mapping from string to flag value for target MMO values that
should be serialized/parsed in MIR output.

Add implementation of this hook for AArch64 SuppressPair MMO flag.

Reviewers: bogner, hfinkel, qcolombet, MatzeB

Subscribers: mcrosier, javed.absar, llvm-commits

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

llvm-svn: 307877
2017-07-13 02:28:54 +00:00
NAKAMURA Takumi 02d34adfd8 clang-tools-extra/test/clang-tidy/performance-unnecessary-value-param-header.cpp: Resolve flakiness in the test.
Tests would go flaky if;
1. Using %T (not %t)
2. Put a file with common name like header.h into %T
3. Other tests (eg. misc-unused-parameters.cpp) are doing as well

We should avoid using %T unless it really makes sense.

llvm-svn: 307876
2017-07-13 02:06:30 +00:00
Kostya Serebryany 8050ea16b5 [libFuzzer] make sure that -reduce_inputs=1 deletes redundant files in the corpus
llvm-svn: 307875
2017-07-13 01:56:37 +00:00
Davide Italiano 094105a0c7 [sanstats] Remove a flaky test.
I don't know a reliable way of crafting a test for this case,
but I'll try a little harder. In the meanwhile, let's get the
bots green again. Please note this will be tested by `check-cfi`
once r307215 relands.

llvm-svn: 307874
2017-07-13 01:36:12 +00:00
Kostya Serebryany 1ca738809a [libFuzzer] experimental feature -reduce_inputs (off by default) that tries to replace elements in the corpus with smaller ones that have the same feature set. Still needs tuning
llvm-svn: 307873
2017-07-13 01:08:53 +00:00
Wolfgang Pieb 515d0e5001 [DWARF] Fixing a bug with processing of DWARF v5 indexed strings in Mach-O objects.
Code to convert MachO - specific section debug section names to standard DWARF v5
section names was in the wrong place.

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

llvm-svn: 307872
2017-07-13 01:03:28 +00:00
Davide Italiano 4d6ef11e48 [sanstats] Print the correct line information.
The instrumentation tracks the return address and not that of the
call so we remove one to compensate. Thanks for Peter Collingbourne
for confirming the analysis of the problem.

llvm-svn: 307871
2017-07-13 00:49:03 +00:00
Jim Ingham a6c57dd989 The llvm.org bugzilla moved.
llvm-svn: 307870
2017-07-13 00:36:21 +00:00
Xinliang David Li 028c78b593 Fix broken test
llvm-svn: 307869
2017-07-13 00:22:01 +00:00
Vitaly Buka 9fd492e71e [asan] Avoid recompilation of the same code in the test
llvm-svn: 307868
2017-07-12 23:59:22 +00:00
Rafael Espindola 300b38678c Refactor gdb index creation.
I have a patch to let DwarfContext defer to lld for getting section
contents and relocations.

That is a pretty big performance improvement.

This is just a refactoring to make that easier to do.

This change makes the *creation* of gdb index a dedicated step and
makes that templated. That is so that we can uses Elf_Rel in the code.

llvm-svn: 307867
2017-07-12 23:56:53 +00:00
Eli Friedman 6f7c9ad7d4 [CodeGenPrepare] Don't create dead instructions in addrmode sinking
When we fail to sink an instruction, we must make sure not to modify
the function; otherwise, we end up in an infinite loop because
CodeGenPrepare iterates until it doesn't make any changes.

Fixes https://bugs.llvm.org/show_bug.cgi?id=33608 .

llvm-svn: 307866
2017-07-12 23:30:02 +00:00
Kuba Mracek c1e903be19 [asan] For iOS/AArch64, if the dynamic shadow doesn't fit, restrict the VM space
On iOS/AArch64, the address space is very limited and has a dynamic maximum address based on the configuration of the device. We're already using a dynamic shadow, and we find a large-enough "gap" in the VM where we place the shadow memory. In some cases and some device configuration, we might not be able to find a large-enough gap: E.g. if the main executable is linked against a large number of libraries that are not part of the system, these libraries can fragment the address space, and this happens before ASan starts initializing.

This patch has a solution, where we have a "backup plan" when we cannot find a large-enough gap: We will restrict the address space (via MmapFixedNoAccess) to a limit, for which the shadow limit will fit.

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

llvm-svn: 307865
2017-07-12 23:29:21 +00:00
Xinliang David Li 07df59b7b6 [PGO] Add a test for 2-deep loop nest
llvm-svn: 307864
2017-07-12 23:28:45 +00:00
Xinliang David Li f564c6959e [PGO] Enhance pgo counter promotion
This is an incremental change to the promotion feature.

There are two problems with the current behavior:
1) loops with multiple exiting blocks are totally disabled
2) a counter update can only be promoted one level up in
  the loop nest -- which does help much for short trip
  count inner loops inside a high trip-count outer loops.

Due to this limitation, we still saw very large profile
count fluctuations from run to run for the affected loops
which are usually very hot.

This patch adds the support for promotion counters iteratively
across the loop nest. It also turns on the promotion for
loops with multiple exiting blocks (with a limit).

For single-threaded applications, the performance impact is flat
on average. For instance, dealII improves, but povray regresses.

llvm-svn: 307863
2017-07-12 23:27:44 +00:00
Kostya Serebryany aa356c3cd5 [libFuzzer] relax test/shrink.test a bit (got broken on windows)
llvm-svn: 307862
2017-07-12 23:22:32 +00:00
Matt Arsenault ce34ac588e AMDGPU: Fix converting unanalyzable global loads to SMRD
Not all memory dependence queries succeed, so this needs to
be conservative if it fails.

llvm-svn: 307861
2017-07-12 23:06:18 +00:00
Gerolf Hoflehner 3f164318e7 [SjLj] Replace recursive block marking algorithm with iterative algorithm
Summary:
Some programs run into a stack overflow issue. This change avoids this
problem by replacing the recursive algorithm with the iterative version.

Reviewers: MatzeB, t.p.northover, dblaikie

Reviewed By: MatzeB

Subscribers: llvm-commits

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

llvm-svn: 307860
2017-07-12 23:05:15 +00:00
Sanjay Patel ac29895173 [x86] add select-of-constant tests; NFC
We're using cmov in these cases, but we could reduce to simpler ops.

llvm-svn: 307859
2017-07-12 22:42:39 +00:00