1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-25 05:52:53 +02:00
Commit Graph

143560 Commits

Author SHA1 Message Date
Sanjay Patel
2afe78e0f9 [InstCombine] add tests for ashr-ashr; NFC
llvm-svn: 292724
2017-01-21 17:43:06 +00:00
Lang Hames
4879b869b8 [Orc][RPC] Add 'removeHandler' and 'clearHandlers' methods to RPC endpoints.
This can be used to free handler resources for handlers that won't be called
again.

llvm-svn: 292714
2017-01-21 07:46:03 +00:00
Craig Topper
35349180a5 [X86] Don't allow commuting to form phsub operations.
Fixes PR31714.

llvm-svn: 292713
2017-01-21 06:59:38 +00:00
Craig Topper
8fa93ef7d3 [X86] Add test cases that show bad commuting being allowed to create a phsub operation.
llvm-svn: 292712
2017-01-21 06:59:35 +00:00
Mehdi Amini
8556288c7b Add missing dependency to "Module Summary Analysis" pass
This is fixing a clang crash when running `clang -flto=thin -save-temps`

llvm-svn: 292711
2017-01-21 06:01:22 +00:00
Chandler Carruth
b1b61e803a [PM] Sink an LCSSA preservation assert from the LoopSimplify pass into
the library routine shared with the new PM and other code.

This assert checks that when LCSSA preservation is requested we start in
LCSSA form. Without this early assert, given *very* complex test cases
we can hit an assert or crash much later on when trying to preserve
LCSSA.

The new PM's loop simplify doesn't need to (and indeed can't) preserve
LCSSA as the new PM doesn't deal in transforms in the dependency graph.
But we asked the library to and shockingly, this didn't work very well!
Stop doing that. Now the assert will tell us immediately with existing
test cases. Before this, it took a pretty convoluted input to trigger
this.

However, sinking the assert also found a bug in LoopUnroll where we
asked simplifyLoop to preserve LCSSA *right before we reform it*. That's
kinda silly and unsurprising that it wasn't available. =D Stop doing
that too.

We also would assert that the unrolled loop was in LCSSA even if
preserving LCSSA was never requested! I don't have a test case or
anything here. I spotted it by inspection and it seems quite obvious. No
logic change anyways, that's just avoiding a spurrious assert.

llvm-svn: 292710
2017-01-21 04:16:53 +00:00
Chandler Carruth
55a970e801 [PM] Teach the loop PM to run LoopSimplify prior to the loop pipeline.
This adds the last remaining core feature of the loop pass pipeline in
the new PM and removes the last of the really egregious hacks in the
LICM tests.

Sadly, this requires really substantial changes in the unittests in
order to provide and maintain simplified loops. This is particularly
hard because for example LoopSimplify will try to fold undef branches to
an ideal direction and simplify the loop accordingly.

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

llvm-svn: 292709
2017-01-21 03:48:51 +00:00
Saleem Abdulrasool
296c4efcd8 llvm-strings: remove default for -Wcovered-switch-default
Fix the -Werror build by removing the unnecessary default case in the
covered switch.  NFC

llvm-svn: 292708
2017-01-21 02:52:29 +00:00
Saleem Abdulrasool
91d8a138d1 llvm-strings: add support for -t
Allow printing the file content offset via the `-t` or `--radix` option.

llvm-svn: 292707
2017-01-21 02:36:28 +00:00
Saleem Abdulrasool
8ad528a3bf llvm-cxxfilt: support the -s option
This is a stub implementation of the `-s` or `--format` option that
allows the user to specify the demangling style.  Since we only support
the Itanium (GNU) style demangling, auto is synonymous with `gnu`.
Simply swallow the option to permit some level of commandline
compatibility.

llvm-svn: 292706
2017-01-21 02:36:26 +00:00
Matthias Braun
0243836cdd LiveRegUnits: Add accumulateBackward() function
Re-Commit r292543 with a fix for the situation when the chain end is
MBB.end().

This function can be used to accumulate the set of all read and modified
register in a sequence of instructions.

Use this code in AArch64A57FPLoadBalancing::scavengeRegister() to prove
the concept.

- The AArch64A57LoadBalancing code is using a backwards analysis now
  which is irrespective of kill flags. This is the main motivation for
  this change.

Differential Revision: http://reviews.llvm.org/D22082

llvm-svn: 292705
2017-01-21 02:21:04 +00:00
Xin Tong
25c35fa2ae Fix Grammar. NFCI.
llvm-svn: 292704
2017-01-21 02:11:40 +00:00
Michael Kuperstein
fe5c6f1abe [SLP] Make ReductionOpcode have the right (enum) type. NFC.
llvm-svn: 292703
2017-01-21 02:03:03 +00:00
Anmol P. Paralkar
abe4552937 MergeFunctions: Preserve debug info in thunks, under option -mergefunc-preserve-debug-info
Summary:
Under option -mergefunc-preserve-debug-info we:
- Do not create a new function for a thunk.
- Retain the debug info for a thunk's parameters (and associated
  instructions for the debug info) from the entry block.
  Note: -debug will display the algorithm at work.
- Create debug-info for the call (to the shared implementation) made by
  a thunk and its return value.
- Erase the rest of the function, retaining the (minimally sized) entry
  block to create a thunk.
- Preserve a thunk's call site to point to the thunk even when both occur
  within the same translation unit, to aid debugability. Note that this
  behaviour differs from the underlying -mergefunc implementation which
  modifies the thunk's call site to point to the shared implementation
  when both occur within the same translation unit.

Reviewers: echristo, eeckstein, dblaikie, aprantl, friss

Reviewed By: aprantl

Subscribers: davide, fhahn, jfb, mehdi_amini, llvm-commits

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

llvm-svn: 292702
2017-01-21 02:02:56 +00:00
Justin Lebar
1a976ec6c1 [ConstantFold] Remove test checking that we don't constant-fold sqrt(-2).
This depended on libm's errno behavior (we constant fold iff libm's
sqrt(-2) does not set errno) and was breaking on mac.

llvm-svn: 292701
2017-01-21 02:02:27 +00:00
Peter Collingbourne
309d88535a LowerTypeTests: Fix use-after-free. Found by asan/msan.
llvm-svn: 292700
2017-01-21 01:57:44 +00:00
Eugene Zelenko
2b0128c404 [AMDGPU] Fix build broken in r292688.
llvm-svn: 292699
2017-01-21 01:34:25 +00:00
Michael Kuperstein
88e863dd60 [SLP] Delete useless helper. NFC.
The helper contained a branch for a special case that is unnecessary,
and a cast.

llvm-svn: 292698
2017-01-21 01:33:25 +00:00
Vitaly Buka
a655e12a39 [libFuzzer] Use CXX to set compiler to use
Reviewers: kcc

Subscribers: llvm-commits

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

llvm-svn: 292697
2017-01-21 01:21:56 +00:00
Kostya Serebryany
e83f7502b4 [libFuzzer] fix gcc build
llvm-svn: 292695
2017-01-21 01:08:22 +00:00
Justin Lebar
46f00f2f07 [NVPTX] Auto-upgrade some NVPTX intrinsics to LLVM target-generic code.
Summary:
Specifically, we upgrade llvm.nvvm.:

 * brev{32,64}
 * clz.{i,ll}
 * popc.{i,ll}
 * abs.{i,ll}
 * {min,max}.{i,ll,u,ull}
 * h2f

These either map directly to an existing LLVM target-generic
intrinsic or map to a simple LLVM target-generic idiom.

In all cases, we check that the code we generate is lowered to PTX as we
expect.

These builtins don't need to be backfilled in clang: They're not
accessible to user code from nvcc.

Reviewers: tra

Subscribers: majnemer, cfe-commits, llvm-commits, jholewinski

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

llvm-svn: 292694
2017-01-21 01:00:32 +00:00
Justin Lebar
dc477c88bd [NVPTX] Move getDivF32Level, usePrecSqrtF32, and useF32FTZ into out of DAGToDAG and into TargetLowering.
Summary:
DADToDAG has access to TargetLowering, but not vice versa, so this is
the more general location for these functions.

NFC

Reviewers: tra

Subscribers: jholewinski, llvm-commits

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

llvm-svn: 292693
2017-01-21 01:00:14 +00:00
Justin Lebar
22610cd767 [ConstantFolding] Constant-fold llvm.sqrt(x) like other intrinsics.
Summary:
Currently we return undef, but we're in the process of changing the
LangRef so that llvm.sqrt behaves like the other math intrinsics,
matching the return value of the standard libcall but not setting errno.

This change is legal even without the LangRef change because currently
calling llvm.sqrt(x) where x is negative is spec'ed to be UB.  But in
practice it's also safe because we're simply constant-folding fewer
inputs: Inputs >= -0 get constant-folded as before, but inputs < -0 now
aren't constant-folded, because ConstantFoldFP aborts if the host math
function raises an fp exception.

Reviewers: hfinkel, efriedma, sanjoy

Subscribers: llvm-commits

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

llvm-svn: 292692
2017-01-21 00:59:57 +00:00
Justin Lebar
20ae0dcecf [ValueTracking] Clarify comments on CannotBeOrderedLessThanZero and SignBitMustBeZero.
Reviewers: hfinkel, efriedma, sanjoy

Subscribers: llvm-commits

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

llvm-svn: 292691
2017-01-21 00:59:40 +00:00
Justin Lebar
4ad528580a [NVPTX] Add explicit check for llvm.sqrt.f32 to intrinsics.ll.
Test-only change.

llvm-svn: 292690
2017-01-21 00:59:23 +00:00
Eugene Zelenko
10b1a2eda2 [AMDGPU] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 292688
2017-01-21 00:53:49 +00:00
Tim Shen
9f6dd6e713 [APFloat] Add asserts and descriptions. NFC.
llvm-svn: 292687
2017-01-21 00:37:53 +00:00
Kostya Serebryany
8cde0a4691 [libFuzzer] use print+exit(1) instead of assert to report an error
llvm-svn: 292685
2017-01-21 00:13:50 +00:00
Kostya Serebryany
5be455e59e [libFuzzer] re-enable LLVMFuzzer-RepeatedMemcmp test, cleanup the test runner nearby
llvm-svn: 292683
2017-01-21 00:01:27 +00:00
Sanjay Patel
15f61be538 [InstCombine] auto-generate checks; NFC
llvm-svn: 292682
2017-01-20 23:39:01 +00:00
Kostya Serebryany
098865e53c [libFuzzer] call __sanitizer_dump_coverage via EF
llvm-svn: 292681
2017-01-20 23:35:29 +00:00
Guozhi Wei
bf27edd95f [PPC] Give unaligned memory access lower cost on processor that supports it
Newer ppc supports unaligned memory access, it reduces the cost of unaligned memory access significantly. This patch handles this case in PPCTTIImpl::getMemoryOpCost.

This patch fixes pr31492.

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

llvm-svn: 292680
2017-01-20 23:35:27 +00:00
Mehdi Amini
7a9494b639 [ThinLTO] Don't perform computeDeadSymbols during O0 link, as the result is never used (NFC)
llvm-svn: 292679
2017-01-20 23:34:12 +00:00
Davide Italiano
ad5b04fd3b [NewGVN] Optimize processing for instructions found trivially dead.
Don't call `isTriviallyDeadInstructions()` once we discover that
an instruction is dead. Instead, set DFS number zero (as suggested
by Danny) and forget about it (this also speeds up things as we
won't try to reprocess that block).

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

llvm-svn: 292676
2017-01-20 23:29:28 +00:00
Tim Northover
193fdef800 GlobalISel: prevent heap use-after-free when looking up VReg.
Translating the constant can create more VRegs, which can invalidate the
reference into the DenseMap. So we have to look up the value again after all
that's happened.

llvm-svn: 292675
2017-01-20 23:25:17 +00:00
Peter Collingbourne
b815fa1b9f LowerTypeTests: Simplify; always create SizeM1 with type IntPtrTy, move initialization out of if statement.
llvm-svn: 292674
2017-01-20 23:22:28 +00:00
Dehao Chen
458d75fcda Add indirect call promotion to SamplePGO
Summary: This patch adds metadata for indirect call promotion in the sample profile loader.

Reviewers: xur, davidxl, dnovillo

Reviewed By: davidxl

Subscribers: llvm-commits

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

llvm-svn: 292672
2017-01-20 22:56:07 +00:00
Marcos Pividori
a7964daddb [libFuzzer] Don't use #ifdef for defined macros, instead use #if.
Differential Revision: https://reviews.llvm.org/D28972

llvm-svn: 292670
2017-01-20 22:49:13 +00:00
Marcos Pividori
769b698900 [libFuzzer] Use clang as linker on Windows, to properly include sanitizer libraries.
In order to use sanitizers on Windows, we need to link against many runtime
libraries which will depend on the target being created (executable or dll) and
the c runtime library used (MT/MD).
By default, cmake uses link.exe for linking, which fails because we don't
specify the appropiate dependencies. As we don't want to consider all of that
possible situations which depends on the implementation of the compiler-rt, the
simplest option is to change the rules for linking executables and shared
libraries, using the compiler instead of link.exe.
Clang driver will consider the sanitizer flags, and automatically provide the
required libraries to the linker.

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

llvm-svn: 292669
2017-01-20 22:49:08 +00:00
Marcos Pividori
5331dce234 [libFuzzer] Properly use compiler options supported on Windows.
Replace "-g" by "-gline-tables-only". "-g" is not supported by clang-cl.

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

llvm-svn: 292668
2017-01-20 22:48:47 +00:00
Mehdi Amini
e74b013127 [ThinLTO] The "codegen only" path didn't honor the recently added file-based API
llvm-svn: 292667
2017-01-20 22:45:34 +00:00
Easwaran Raman
9e1b62af44 Improve PGO support for the new inliner
This adds the following to the new PM based inliner in PGO mode:

* Use block frequency analysis to derive callsite's profile count and use
that to adjust thresholds of hot and cold callsites.

* Incrementally update the BFI of the caller after a callee gets inlined
into it. This incremental update is only within an invocation of the run
method - BFI is not preserved across calls to run.
Update the function entry count of the callee after inlining it into a
caller.

* I've tuned the thresholds for the hot and cold callsites using a hacked
up version of the old inliner that explicitly computes BFI on a set of
internal benchmarks and spec. Once the new PM based pipeline stabilizes
(IIRC Chandler mentioned there are known issues) I'll benchmark this
again and adjust the thresholds if required.
Inliner PGO support.

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

llvm-svn: 292666
2017-01-20 22:44:04 +00:00
Zachary Turner
f1baa97ebf [pdb] Write the Named Stream mapping to Yaml and binary.
Differential Revision: https://reviews.llvm.org/D28919

llvm-svn: 292665
2017-01-20 22:42:09 +00:00
Zachary Turner
79947989cc [pdb] Merge NamedStreamMapBuilder and NamedStreamMap.
While the builder pattern has proven useful for certain other
larger types, in this case it was hampering the ability to use
the data structure, as for runtime access we need a map that
we can efficiently read from and write to.  So the two are merged
into a single data structure that can efficiently be read to,
written from, deserialized from bytes, and serialized to bytes.

llvm-svn: 292664
2017-01-20 22:41:40 +00:00
Zachary Turner
63cd78b19a [PDB] Rename some files to be more intuitive.
llvm-svn: 292663
2017-01-20 22:41:15 +00:00
Peter Collingbourne
99444ca866 IPO, LTO: Plumb the summary from the LTO API into the pass manager.
Differential Revision: https://reviews.llvm.org/D28840

llvm-svn: 292661
2017-01-20 22:18:52 +00:00
Sanjay Patel
fc6ca85023 [ValueTracking] recognize variations of 'clamp' to improve codegen (PR31693)
By enhancing value tracking, we allow an existing min/max canonicalization to
kick in and improve codegen for several targets that have min/max instructions.

Unfortunately, recognizing min/max in value tracking may cause us to hit
a hack in InstCombiner::visitICmpInst() more often:
http://lists.llvm.org/pipermail/llvm-dev/2017-January/109340.html
...but I'm hoping we can remove that soon.

Correctness proofs based on Alive:

Name: smaxmin
Pre: C1 < C2
%cmp2 = icmp slt i8 %x, C2
%min = select i1 %cmp2, i8 %x, i8 C2
%cmp3 = icmp slt i8 %x, C1
%r = select i1 %cmp3, i8 C1, i8 %min
=>
%cmp2 = icmp slt i8 %x, C2
%min = select i1 %cmp2, i8 %x, i8 C2
%cmp1 = icmp sgt i8 %min, C1
%r = select i1 %cmp1, i8 %min, i8 C1

Name: sminmax
Pre: C1 > C2
%cmp2 = icmp sgt i8 %x, C2
%max = select i1 %cmp2, i8 %x, i8 C2
%cmp3 = icmp sgt i8 %x, C1
%r = select i1 %cmp3, i8 C1, i8 %max
=>
%cmp2 = icmp sgt i8 %x, C2
%max = select i1 %cmp2, i8 %x, i8 C2
%cmp1 = icmp slt i8 %max, C1
%r = select i1 %cmp1, i8 %max, i8 C1

---------------------------------------- 
Optimization: smaxmin 
Done: 1 
Optimization is correct! 
---------------------------------------- 
Optimization: sminmax 
Done: 1 
Optimization is correct!



Name: umaxmin
Pre: C1 u< C2
%cmp2 = icmp ult i8 %x, C2
%min = select i1 %cmp2, i8 %x, i8 C2
%cmp3 = icmp ult i8 %x, C1
%r = select i1 %cmp3, i8 C1, i8 %min
=>
%cmp2 = icmp ult i8 %x, C2
%min = select i1 %cmp2, i8 %x, i8 C2
%cmp1 = icmp ugt i8 %min, C1
%r = select i1 %cmp1, i8 %min, i8 C1

Name: uminmax
Pre: C1 u> C2
%cmp2 = icmp ugt i8 %x, C2
%max = select i1 %cmp2, i8 %x, i8 C2
%cmp3 = icmp ugt i8 %x, C1
%r = select i1 %cmp3, i8 C1, i8 %max
=>
%cmp2 = icmp ugt i8 %x, C2
%max = select i1 %cmp2, i8 %x, i8 C2
%cmp1 = icmp ult i8 %max, C1
%r = select i1 %cmp1, i8 %max, i8 C1

---------------------------------------- 
Optimization: umaxmin 
Done: 1 
Optimization is correct! 
---------------------------------------- 
Optimization: uminmax 
Done: 1 
Optimization is correct! 
 

llvm-svn: 292660
2017-01-20 22:18:47 +00:00
Peter Collingbourne
04b1dc5f67 docs: Document that !absolute_symbol { all-ones, all-ones } means the full set.
llvm-svn: 292657
2017-01-20 21:56:37 +00:00
Teresa Johnson
058a6c09b9 [ThinLTO] Drop non-prevailing non-ODR weak to declarations
Summary:
Allow non-ODR weak/linkonce non-prevailing copies to be marked
as available_externally in the index. Add support for dropping these to
declarations in the backend.

Reviewers: mehdi_amini, pcc

Subscribers: llvm-commits

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

llvm-svn: 292656
2017-01-20 21:54:58 +00:00
Sanjay Patel
cbf458f9f0 [InstCombine] add tests to show missed canonicalization of min/max; NFC
Unfortunately, recognizing these in value tracking may cause us to hit
a hack in InstCombiner::visitICmpInst() more often:
http://lists.llvm.org/pipermail/llvm-dev/2017-January/109340.html

...but besides being the obviously Right Thing To Do, there's a clear 
codegen win from identifying these patterns for several targets.

llvm-svn: 292655
2017-01-20 21:49:41 +00:00