Commit Graph

267808 Commits

Author SHA1 Message Date
Ilya Biryukov 103aedd285 NFC. Fixed typos in the comments.
llvm-svn: 308888
2017-07-24 16:02:29 +00:00
Michael Kruse 54071126d8 [ForwardOpTree] Properly indent enumeration in comment. NFC.
llvm-svn: 308887
2017-07-24 15:34:03 +00:00
Michael Kruse 67752076bc [ForwardOpTree] Rename FD_CanForward to FD_CanForwardLeaf. NFC.
To make the meaning and distinction to FD_CanForwardTree clearer.

llvm-svn: 308886
2017-07-24 15:33:58 +00:00
Michael Kruse d85e345ce0 [ForwardOpTree] Add comments to ForwardingDecision items. NFC.
In particular, explain the difference between FD_CanForward
and FD_CanForwardTree.

llvm-svn: 308885
2017-07-24 15:33:53 +00:00
Kostya Kortchinsky 2d94405a32 [scudo] Quarantine overhaul
Summary:
First, some context.

The main feedback we get about the quarantine is that it's too memory hungry.
A single MB of quarantine will have an impact of 3 to 4MB of PSS/RSS, and
things quickly get out of hand in terms of memory usage, and the quarantine
ends up disabled.

The main objective of the quarantine is to protect from use-after-free
exploitation by making it harder for an attacker to reallocate a controlled
chunk in place of the targeted freed chunk. This is achieved by not making it
available to the backend right away for reuse, but holding it a little while.

Historically, what has usually been the target of such attacks was objects,
where vtable pointers or other function pointers could constitute a valuable
targeti to replace. Those are usually on the smaller side. There is barely any
advantage in putting the quarantine several megabytes of RGB data or the like.

Now for the patch.

This patch introduces a new way the Quarantine behaves in Scudo. First of all,
the size of the Quarantine will be defined in KB instead of MB, then we
introduce a new option: the size up to which (lower than or equal to) a chunk
will be quarantined. This way, we only quarantine smaller chunks, and the size
of the quarantine remains manageable. It also prevents someone from triggering
a recycle by allocating something huge. We default to 512 bytes on 32-bit and
2048 bytes on 64-bit platforms.

In details, the patches includes the following:
- introduce `QuarantineSizeKb`, but honor `QuarantineSizeMb` if set to fall
  back to the old behavior (meaning no threshold in that case);
  `QuarantineSizeMb` is described as deprecated in the options descriptios;
  documentation update will follow;
- introduce `QuarantineChunksUpToSize`, the new threshold value;
- update the `quarantine.cpp` test, and other tests using `QuarantineSizeMb`;
- remove `AllocatorOptions::copyTo`, it wasn't used;
- slightly change the logic around `quarantineOrDeallocateChunk` to accomodate
  for the new logic; rename a couple of variables there as well;

Rewriting the tests, I found a somewhat annoying bug where non-default aligned
chunks would account for more than needed when placed in the quarantine due to
`<< MinAlignment` instead of `<< MinAlignmentLog`. This is fixed and tested for
now.

Reviewers: alekseyshl, kcc

Reviewed By: alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 308884
2017-07-24 15:29:38 +00:00
Alexey Bataev f189cb79d4 [OPENMP] Fix the restrictions for in_reduction clause.
This patch allows to use in_reduction clause even if the innermost
directive is not taskgroup.

llvm-svn: 308883
2017-07-24 14:52:13 +00:00
Krasimir Georgiev 3e05105486 [clang-format] Fix comment levels between '} else {' and PPDirective.
Summary:
This fixes a regression exposed by r307795 and rL308725 in which the level of a
comment line between '} else {' and a preprocessor directive is incorrectly set
as the level of the '} else {' line. For example, this :
```
int f(int i) {
  if (i) {
    ++i;
  } else {
    // comment
#ifdef A
    --i;
#endif
  }
}
```
was formatted as:
```
int f(int i) {
  if (i) {
    ++i;
  } else {
  // comment
#ifdef A
    --i;
#endif
  }
}
```

Reviewers: djasper, klimek

Reviewed By: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 308882
2017-07-24 14:51:59 +00:00
Francis Ricci 4f82717643 [compiler-rt] Add missing const specifier to MemoryMappedSegment functions
llvm-svn: 308881
2017-07-24 14:31:01 +00:00
Marshall Clow e5cc2fcc90 make sure that we don't call basic_streambuf::gbump with a value bigger than INT_MAX, since it only takes an int. Related to, but not quite the same as PR33725
llvm-svn: 308880
2017-07-24 14:05:10 +00:00
Simon Dardis 7d31878674 [mips] Add support for -m(no-)extern-data.
Add support for -m(no-)extern-data when using -mgpopt in the driver. It is
enabled by default in the backend.

Reviewers: atanasyan, slthakur

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

llvm-svn: 308879
2017-07-24 14:02:09 +00:00
Alexandre Isoard eca33fc976 [DOTGraphTraits] Propagate Graph template argument, NFC
Propagates the GraphT template argument to the default value of
the AnalysisGraphTraitsT template argument. This allows to specialize
the DefaultAnalysisGraphTraits<AnalysisT,GraphT> for analysis with a
graph type different from the analysis type and it will automatically
get picked-up.

Note: This was probably the intended purpose and should not result in any
      functional change.
llvm-svn: 308878
2017-07-24 12:55:00 +00:00
Simon Pilgrim 0f65ab020a Fix spelling in comments. NFCI.
llvm-svn: 308877
2017-07-24 12:44:35 +00:00
Michael Kruse 07e8c36dc7 [ForwardOpTree] Support read-only value uses.
Read-only values (values defined before the SCoP) require special
handing with -polly-analyze-read-only-scalars=true (which is the
default). If active, each use of a value requires a read access.
When a copied value uses a read-only value, we must also ensure that
such a MemoryAccess is available or is created.

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

llvm-svn: 308876
2017-07-24 12:43:27 +00:00
Siddharth Bhat e2699b572e [Polly] [NFC] [ScopDetection] Make `polly-only-func` perform regex scop name match.
Summary:

- We were using `.count` in `StringRef`, which matches substrings.
- We may want to use this for equality as well.
- Generalise this, so allow regexes as a parameter to `polly-only-func`.

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

llvm-svn: 308875
2017-07-24 12:40:52 +00:00
Michael Kruse 5b8a9095e8 [ForwardOpTree] Fix mixup in comment. NFC.
The cases DoIt==false and DoIt==true were mixed up.

Thanks to Siddharth for noticing.

llvm-svn: 308874
2017-07-24 12:39:46 +00:00
Michael Kruse 25a688165b [ScopInfo] Fix typo in method name. NFC.
prependInstrunction -> prependInstruction

Thanks Nandini for noticing.

llvm-svn: 308873
2017-07-24 12:39:41 +00:00
Florian Hahn f66efd6181 [LoopInterchange] Update code to use range-based for loops (NFC).
Summary:
The remaining non range-based for loops do not iterate over full ranges,
so leave them as they are.

Reviewers: karthikthecool, blitz.opensource, mcrosier, mkuper, aemerson

Reviewed By: aemerson

Subscribers: aemerson, mzolotukhin, llvm-commits

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

llvm-svn: 308872
2017-07-24 11:41:30 +00:00
Momchil Velikov 81806c5d4d [libunwind] Handle .ARM.exidx tables without sentinel last entry
UnwindCursor<A, R>::getInfoFromEHABISection assumes the last
entry in the index table never corresponds to a real function.
Indeed, GNU ld always inserts an EXIDX_CANTUNWIND entry,
containing the end of the .text section. However, the EHABI specification
(http://infocenter.arm.com/help/topic/com.arm.doc.ihi0038b/IHI0038B_ehabi.pdf)
does not seem to contain text that requires the presence of a sentinel entry.
In that sense the libunwind implementation isn't compliant with the specification.

This patch makes getInfoFromEHABISection examine the last entry in the index
table if upper_bound returns the end iterator.

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

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

llvm-svn: 308871
2017-07-24 09:19:32 +00:00
Siddharth Bhat f7face4bc4 Convert GPUNodeBuilder::getArraySize to islcpp.
Note: PPCGCodeGeneration::pollyBuildAstExprForStmt is at
      https://reviews.llvm.org/D35770

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

llvm-svn: 308870
2017-07-24 09:08:21 +00:00
Siddharth Bhat 35de900917 [NFC] Move PPCGCodeGeneration::pollyBuildAstExprForStmt to isl++.
Differential Revision: https://reviews.llvm.org/D35771

llvm-svn: 308869
2017-07-24 08:34:24 +00:00
Ayman Musa b16ce777e3 [X86][AVX512] Add patterns for masked AVX512 floating point compare instructions that were missing.
patterns were missed by D33188. Adding for completion.
+Updating test.

Differential Revesion: https://reviews.llvm.org/D35179

llvm-svn: 308868
2017-07-24 08:10:32 +00:00
Coby Tayree 1f5df89a8c [X86][InlineAsm][Ms Compatibility]Prefer variable name over a register when the two collides
On MS-style, the following snippet:

int eax;
__asm mov eax, ebx

should yield loading of ebx, into the location pointed by the variable eax

This patch sees to it.

Currently, a reg-to-reg move would have been invoked.

llvm: D34739

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

llvm-svn: 308867
2017-07-24 07:06:37 +00:00
Coby Tayree c48388d3d3 [X86][InlineAsm][Ms Compatibility]Prefer variable name over a register when the two collides
On MS-style, the following snippet:

int eax;
__asm mov eax, ebx

should yield loading of ebx, into the location pointed by the variable eax

This patch sees to it.

Currently, a reg-to-reg move would have been invoked.

clang: D34740

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

llvm-svn: 308866
2017-07-24 07:04:55 +00:00
Dylan McKay 6c5c6aa9d8 [AVR] Remove the instrumentation pass
I have a much better way of running integration tests now.

https://github.com/dylanmckay/avr-test-suite

llvm-svn: 308857
2017-07-23 23:39:11 +00:00
Dylan McKay 94c636b7aa [AVR] Improve the 'icall-func-pointer-correct-addr-space.ll' test
Patch by Carl Peto.

llvm-svn: 308856
2017-07-23 23:00:55 +00:00
Petr Hosek 67fe74b122 [Driver] Fuchsia defaults to -fno-math-errno
Patch by Roland McGrath

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

llvm-svn: 308855
2017-07-23 22:30:13 +00:00
Petr Hosek 710479cede [CodeGen][X86] Fuchsia supports sincos* libcalls and sin+cos->sincos optimization
Patch by Roland McGrath

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

llvm-svn: 308854
2017-07-23 22:30:00 +00:00
Momchil Velikov 4e61a7f833 Fix typo: GETTER to SETTER (NFC)
Use the CALLSITE_DELEGATE_SETTER macro in CallSiteBase::setCannotDuplicate.
Comitted as obvious.

llvm-svn: 308853
2017-07-23 22:27:34 +00:00
Florian Hahn 57ffb2c9d8 [AArch64] Add test for function alignment for a optsize function (NFC).
Reviewers: dblaikie, t.p.northover, rengolin

Reviewed By: rengolin

Subscribers: aemerson, rengolin, javed.absar, llvm-commits, kristof.beyls

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

llvm-svn: 308852
2017-07-23 21:15:10 +00:00
Adrian Prantl ed6f69c111 Revert "Fix PR33875 by distinguishing between DWO and clang modules"
This reverts commit r308850.

llvm-svn: 308851
2017-07-23 20:24:41 +00:00
Adrian Prantl 651166c2d2 Fix PR33875 by distinguishing between DWO and clang modules
The DWO handling code can get confused by clang modules which also use
skeleton CUs to point to the object file with the full debug
info. This patch detects whether an object is a "real" DWO or a clang
module and prevents LLDB from interpreting clang modules as DWO. This
fixes the regression in TestWithModuleDebugging.

http://llvm.org/bugs/show_bug.cgi?id=33875

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

llvm-svn: 308850
2017-07-23 17:59:07 +00:00
Chad Rosier 9b2b4c961a [AArch64] Redundant Copy Elimination - remove more zero copies.
This patch removes unnecessary zero copies in BBs that are targets of b.eq/b.ne
and we know the result of the compare instruction is zero.  For example,

BB#0:
  subs w0, w1, w2
  str w0, [x1]
  b.ne .LBB0_2
BB#1:
  mov w0, wzr  ; <-- redundant
  str w0, [x2]
.LBB0_2

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

llvm-svn: 308849
2017-07-23 16:38:08 +00:00
Nico Weber e0c3f90687 Remove Driver::UseStdLib.
All but one place are checking options::OPT_nostdlib instead of looking at
this field, so convert that one other place to doing that as well.

No behavior change.

llvm-svn: 308848
2017-07-23 16:31:47 +00:00
Max Kazantsev 0e9e0796f4 [SCEV] Limit max size of AddRecExpr during evolving
When SCEV calculates product of two SCEVAddRecs from the same loop, it
tries to combine them into one big AddRecExpr. If the sizes of the initial
SCEVs were `S1` and `S2`, the size of their product is `S1 + S2 - 1`, and every
operand of the resulting SCEV is combined from operands of initial SCEV and
has much higher complexity than they have.

As result, if we try to calculate something like:
  %x1 = {a,+,b}
  %x2 = mul i32 %x1, %x1
  %x3 = mul i32 %x2, %x1
  %x4 = mul i32 %x3, %x2
  ...
The size of such SCEVs grows as `2^N`, and the arguments
become more and more complex as we go forth. This leads
to long compilation and huge memory consumption.

This patch sets a limit after which we don't try to combine two
`SCEVAddRecExpr`s into one. By default, max allowed size of the
resulting AddRecExpr is set to 16.

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

llvm-svn: 308847
2017-07-23 15:40:19 +00:00
NAKAMURA Takumi 4c29ca4b9b RuntimeDyldELF.cpp: Prune unused "TargetRegistry.h"
llvm-svn: 308846
2017-07-23 11:47:22 +00:00
Tobias Grosser 325812ac6d Simplify: Adopt for translation of MemoryAccess::getAccessRelation
For some reason this one was missed earlier.

llvm-svn: 308845
2017-07-23 08:15:28 +00:00
NAKAMURA Takumi 7ae667d71e [Modules] Rework r274270. Let Clang targets depend on intrinsics_gen.
This gets rid of almost LLVM targets unconditionally depending on intrinsic_gen.

Clang's modules still have weird dependencies and hard to remove intrinsics_gen in better way.
Then, it'd be better to give whole clang targets depend on intrinsic_gen.

llvm-svn: 308844
2017-07-23 05:09:44 +00:00
Tobias Grosser 1959dbda75 Move MemoryAccess::get*ArrayId to isl++
llvm-svn: 308843
2017-07-23 04:08:59 +00:00
Tobias Grosser 3b196131b5 Move applyScheduleToAccessRelation to isl++
llvm-svn: 308842
2017-07-23 04:08:52 +00:00
Tobias Grosser 6a87036e0f Move MemoryAccess::getAddressFunction to isl++
llvm-svn: 308841
2017-07-23 04:08:45 +00:00
Tobias Grosser 1515f6b937 Move MemoryAccess::NewAccessRelation to isl++
We also move related accessor functions

llvm-svn: 308840
2017-07-23 04:08:38 +00:00
Tobias Grosser 22da5f087a Move MemoryAccess::getOriginalAccessRelation to isl++
llvm-svn: 308839
2017-07-23 04:08:27 +00:00
Tobias Grosser 0c4c2eef75 Move MemoryAccess::AccessRelation to isl++
llvm-svn: 308838
2017-07-23 04:08:22 +00:00
Tobias Grosser b6e7a85a6d Move MemoryAccess::createBasicAccessMap to isl++
llvm-svn: 308837
2017-07-23 04:08:17 +00:00
Tobias Grosser fe46c3ff3a Move MemoryAccess::id to isl++
llvm-svn: 308836
2017-07-23 04:08:11 +00:00
Craig Topper 07a7d56144 [X86] Add some hasSideEffects=0 flags.
llvm-svn: 308835
2017-07-23 03:59:39 +00:00
Craig Topper 6912d7faa3 [X86] Add patterns for memory forms of SARX/SHLX/SHRX with careful complexity adjustment to keep shift by immediate using the legacy instructions.
These patterns were only missing to favor using the legacy instructions when the shift was a constant. With careful adjustment of the pattern complexity we can make sure the immediate instructions still have priority over these patterns.

llvm-svn: 308834
2017-07-23 03:59:37 +00:00
Nirav Dave 4e6dcf73f9 [DAG] Fix typo preventing some stores merges to truncated stores.
Check the actual memory type stored and not the extended value size
when considering if truncated store merge is worthwhile.

Reviewers: efriedma, RKSimon, spatel, jyknight

Reviewed By: efriedma

Subscribers: llvm-commits, nhaehnle

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

llvm-svn: 308833
2017-07-23 02:06:28 +00:00
NAKAMURA Takumi 6876680773 clang/module.modulemap: Split out Clang_ToolingCore from Clang_Tooling.
It cuts clangFormat's dependencies out of;

  Clang_Analysis
  Clang_C
  Clang_Diagnostics
  Clang_Driver
  Clang_Frontend
  Clang_Sema
  Clang_Serialization
  Clang_StaticAnalyzer_Core
  Clang_Tooling -> Clang_ToolingCore

Now, the module Clang_Format depends on;

  Clang_AST
  Clang_Basic
  Clang_ToolingCore

llvm-svn: 308832
2017-07-23 01:40:36 +00:00
Michael Kruse ab8f0d57df [Simplify] Remove partial write accesses with empty domain.
If the access relation's domain is empty, the access will never be
executed. We can just remove it.

We only remove write accesses. Partial read accesses are not yet
supported and instructions in the statement might require the
llvm::Value holding the read's result to be defined.

llvm-svn: 308830
2017-07-22 20:33:09 +00:00