Commit Graph

120791 Commits

Author SHA1 Message Date
Simon Pilgrim
43a339e3bb Renamed min tests (typo)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245038 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 11:03:31 +00:00
James Molloy
f8e7c14a0b [AArch64] FMINNAN/FMAXNAN on f16 is not legal.
Spotted by Ahmed - in r244594 I inadvertently marked f16 min/max as legal.

I've reverted it here, and marked min/max on scalar f16's as promote. I've also added a testcase. The test just checks that the compiler doesn't fall over - it doesn't create fmin nodes for f16 yet.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245035 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 09:08:50 +00:00
Chandler Carruth
0d2d02d317 [PM/AA] Remove two no-op overridden functions that just delegated to the
base class anyways.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245034 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 08:39:32 +00:00
Adam Nemet
8452a3f46e [LVer] Remove unused Pass parameter from versionLoop, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245032 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 06:30:26 +00:00
Lang Hames
de445db1c4 [RuntimeDyld] Make sure code-sections aren't under-aligned.
Code-section alignment should be at least as high as the minimum
stub alignment. If the section alignment is lower it can cause
padding to be emitted resulting in alignment errors if the section
is mapped to a higher alignment on the target.

E.g. If a text section with a 4-byte alignment gets 4-bytes of
padding to guarantee 8-byte alignment for stubs but is re-mapped to
an 8-byte alignment on the target, the 4-bytes of padding will push
the stubs to 4-byte alignment causing a crash.

No test case: There is currently no way to control host section
alignment in llvm-rtdyld. This could be made testable by adding
a custom memory manager. I'll look at that in a follow-up patch.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245031 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 06:26:42 +00:00
David Majnemer
2dacece9e2 [IR] Add token types
This introduces the basic functionality to support "token types".
The motivation stems from the need to perform operations on a Value
whose provenance cannot be obscured.

There are several applications for such a type but my immediate
motivation stems from WinEH.  Our personality routine enforces a
single-entry - single-exit regime for cleanups.  After several rounds of
optimizations, we may be left with a terminator whose "cleanup-entry
block" is not entirely clear because control flow has merged two
cleanups together.  We have experimented with using labels as operands
inside of instructions which are not terminators to indicate where we
came from but found that LLVM does not expect such exotic uses of
BasicBlocks.

Instead, we can use this new type to clearly associate the "entry point"
and "exit point" of our cleanup.  This is done by having the cleanuppad
yield a Token and consuming it at the cleanupret.
The token type makes it impossible to obscure or otherwise hide the
Value, making it trivial to track the relationship between the two
points.

What is the burden to the optimizer?  Well, it turns out we have already
paid down this cost by accepting that there are certain calls that we
are not permitted to duplicate, optimizations have to watch out for
such instructions anyway.  There are additional places in the optimizer
that we will probably have to update but early examination has given me
the impression that this will not be heroic.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245029 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 05:09:07 +00:00
Karthik Bhat
20c7897930 Add support for cross block dse.
This patch enables dead stroe elimination across basicblocks.

Example:
define void @test_02(i32 %N) {
  %1 = alloca i32
  store i32 %N, i32* %1
  store i32 10, i32* @x
  %2 = load i32, i32* %1
  %3 = icmp ne i32 %2, 0
  br i1 %3, label %4, label %5

; <label>:4
  store i32 5, i32* @x
  br label %7

; <label>:5
  %6 = load i32, i32* @x
  store i32 %6, i32* @y
  br label %7

; <label>:7
  store i32 15, i32* @x
  ret void
}
In the above example dead store "store i32 5, i32* @x" is now eliminated.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245025 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 04:17:23 +00:00
Chandler Carruth
41bdb7ca96 [PM/AA] Run clang-format over the ObjCARC Alias Analysis code to
normalize its formatting before I make more substantial changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245024 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 03:57:00 +00:00
Chandler Carruth
416c002bf3 [PM/AA] Don't bother forward declaring Function and Value, just include
their headers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245023 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 03:55:36 +00:00
Saleem Abdulrasool
9465c3170c PowerPC: remove dead initialization (NFC)
Identified by the clang static analyzer.  No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245022 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 03:48:35 +00:00
Chandler Carruth
0d68ddf6ce [PM/AA] Extract the interface for GlobalsModRef into a header along with
its creation function.

This required shifting a bunch of method definitions to be out-of-line
so that we could leave most of the implementation guts in the .cpp file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245021 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 03:48:20 +00:00
Chandler Carruth
40e8a59ff9 [PM/AA] Hoist the interface to TBAA into a dedicated header along with
its creation function. Update the relevant includes accordingly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245019 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 03:33:48 +00:00
Chandler Carruth
51d9f587b7 [PM/AA] Run clang-format over TBAA code to normalize the formatting
before making substantial changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245017 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 03:26:15 +00:00
Chandler Carruth
63147bd117 [PM/AA] Remove a stray #include that snuck in via copy/paste when
creating this header.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245016 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 03:16:11 +00:00
Chandler Carruth
0293ed6a06 [PM/AA] Clean up the SCEV-AA comment formatting and typos.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245015 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 03:14:50 +00:00
Chandler Carruth
72644dfdcd [PM/AA] Run clang-format over the SCEV-AA code to normalize the
formatting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245014 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 03:12:16 +00:00
Chandler Carruth
217849dc42 [PM/AA] Hoist the SCEV-AA interface to its own header and pull the
creation function into that header.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245013 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 03:11:16 +00:00
Chandler Carruth
01910b8f31 [PM/AA] Hoist ScopedNoAliasAA's interface into a header and move the
creation function there.

Same basic refactoring as the other alias analyses. Nothing special
required this time around.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245012 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 02:55:50 +00:00
Chandler Carruth
e115abc777 [PM/AA] Hoist the value handle definition for CFLAA into the header to
satisfy libc++'s std::forward_list which requires the value type to be
complete.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245011 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 02:50:34 +00:00
Chandler Carruth
59300cef7c [PM/AA] Run clang-format over the ScopedNoAliasAA pass prior to making
substantial changes to normalize any formatting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245010 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 02:46:07 +00:00
Chandler Carruth
519ed7c510 [PM/AA] Extract a minimal interface for CFLAA to its own header file.
I've used forward declarations and reorderd the source code some to make
this reasonably clean and keep as much of the code as possible in the
source file, including all the stratified set details. Just the basic AA
interface and the create function are in the header file, and the header
file is now included into the relevant locations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245009 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 02:42:20 +00:00
Chandler Carruth
c269c3d555 [PM/AA] Delete two pointlessly overridden methods on the AA interface by
the AA counter pass.

For pointsToConstantMemory, I think this is a "bug fix" as I think the
code as written will actually infloop if ever reached. For the
getModRefInfo, this is a no-op change but with a significantly simpler
form.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245007 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 02:16:12 +00:00
Chandler Carruth
0dc1606c51 [PM/AA] Sink all the actual code from AliasAnalysisCounter back into the
.cpp file to make the header much less noisy.

Also makes it easy to use a static helper rather than a public method
for printing lines of stats.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245006 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 02:12:12 +00:00
Chandler Carruth
20c9ab5fe6 [PM/AA] Run clang-format over this code to establish a clean baseline
for subsequent changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245005 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 02:07:05 +00:00
Chandler Carruth
968d0e35a5 [PM/AA] Hoist the AA counter pass into a header to match the analysis
pattern.

Also hoist the creation routine out of the generic header and into the
pass header now that we have one.

I've worked to not make any changes, even formatting ones here. I'll
clean up the formatting and other things in a follow-up patch now that
the code is in the right place.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245004 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 02:05:41 +00:00
Jingyue Wu
c4aff77ec0 [SeparateConstOffsetFromGEP] sext(a)+sext(b) => sext(a+b) when a+b can't sign-overflow.
Summary:
This patch implements my promised optimization to reunites certain sexts from
operands after we extract the constant offset. See the header comment of
reuniteExts for its motivation.

One key building block that enables this optimization is Bjarke's poison value
analysis (D11212). That helps to prove "a +nsw b" can't overflow.

Reviewers: broune

Subscribers: jholewinski, sanjoy, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245003 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 02:02:05 +00:00
Chandler Carruth
0d1a277d93 [PM/AA] Remove the function names and class names from doxygen comments
and generally clean up their formatting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245002 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 01:43:46 +00:00
Chandler Carruth
f6f87835da [PM/AA] Move the LibCall AA creation routine declaration to that
analysis's header file to be more consistent with other analyses.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245001 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 01:43:02 +00:00
Chandler Carruth
67bd697ef7 [PM/AA] Run clang-format over LibCallAliasAnalysis prior to making
substantial changes needed for the new pass manager's AA integration.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245000 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 01:38:25 +00:00
David Blaikie
329f95975f Update ExceptionDemo for exception handling API changes (personality function call->function move)
The ExceptionDemo now compiles, but doesn't link... undefined type
references to various typeinfo.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244997 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 00:37:16 +00:00
Alex Lorenz
1dde2af7b6 Update MIRLangRef for MIR syntax change from r244982.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244996 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 00:36:10 +00:00
David Blaikie
54b3a03538 Fix -Wformat warnings in ExceptionDemo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244995 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 00:31:49 +00:00
David Blaikie
00c293b052 Fix up the ExceptionDemo for some API changes over the past <time>
This still doesn't build -Werror clean, but other than that it should at
least build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244994 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 00:24:56 +00:00
Chandler Carruth
62b7c9cb84 [LIR] Re-instate r244880, reverted in r244884, factoring the handling of
AliasAnalysis in LoopIdiomRecognize.

The previous commit to LIR, r244879, exposed some scary bug in the loop
pass pipeline with an assert failure that showed up on several bots.
This patch got reverted as part of getting that revision reverted, but
they're actually independent and unrelated. This patch has no functional
change and should be completely safe. It is also useful for my current
work on the AA infrastructure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244993 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 00:21:10 +00:00
Alex Lorenz
5d09c2f25d MIR Serialization: Change MIR syntax - use custom syntax for MBBs.
This commit modifies the way the machine basic blocks are serialized - now the
machine basic blocks are serialized using a custom syntax instead of relying on
YAML primitives. Instead of using YAML mappings to represent the individual
machine basic blocks in a machine function's body, the new syntax uses a single
YAML block scalar which contains all of the machine basic blocks and
instructions for that function.

This is an example of a function's body that uses the old syntax:

    body:
      - id: 0
        name: entry
        instructions:
          - '%eax = MOV32r0 implicit-def %eflags'
          - 'RETQ %eax'
    ...

The same body is now written like this:

    body: |
      bb.0.entry:
        %eax = MOV32r0 implicit-def %eflags
        RETQ %eax
    ...

This syntax change is motivated by the fact that the bundled machine
instructions didn't map that well to the old syntax which was using a single
YAML sequence to store all of the machine instructions in a block. The bundled
machine instructions internally use flags like BundledPred and BundledSucc to
determine the bundles, and serializing them as MI flags using the old syntax
would have had a negative impact on the readability and the ease of editing
for MIR files. The new syntax allows me to serialize the bundled machine
instructions using a block construct without relying on the internal flags,
for example:

   BUNDLE implicit-def dead %itstate, implicit-def %s1 ... {
      t2IT 1, 24, implicit-def %itstate
      %s1 = VMOVS killed %s0, 1, killed %cpsr, implicit killed %itstate
   }

This commit also converts the MIR testcases to the new syntax. I developed
a script that can convert from the old syntax to the new one. I will post the
script on the llvm-commits mailing list in the thread for this commit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244982 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-13 23:10:16 +00:00
Sanjay Patel
9ce155daf1 don't repeat function names in comments; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244977 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-13 22:53:20 +00:00
David Majnemer
b21cc6bd48 [IR] Cleanup indentation of EH instructions
No functional change is intended, just tidying up whitespace.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244966 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-13 22:11:40 +00:00
Simon Pilgrim
bf616c106e [AMDGPU] Use the general SMAX/SMIN/UMAX/UMIN pattern matching and remove the AMDGPU implementation
D9746 added general SMAX/SMIN/UMAX/UMIN pattern matching to SelectionDAGBuilder::visitSelect.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244960 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-13 21:40:02 +00:00
Ahmed Bougacha
7409d94d2d [AArch64] Provide "too few operands" diags on short-form NEON also.
We used to just say "invalid type suffix for instruction", which is
misleading. This is because we fallback to the long-form matcher if the
short-form matcher failed, losing the error information on the way.

Save it, so that we can provide a little better diagnostics when the
long-form matcher thinks a suffix is the cause of the error.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244955 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-13 21:09:13 +00:00
Alex Lorenz
1b93706717 MIR Parser: Don't allow negative alignments for memory operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244953 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-13 20:55:01 +00:00
Simon Pilgrim
bec1b77e9b [X86][SSE] Use the general SMAX/SMIN/UMAX/UMIN pattern matching and remove the X86 implementation
Follow up to D10947 - D9746 added general SMAX/SMIN/UMAX/UMIN pattern matching to SelectionDAGBuilder::visitSelect.

This patch removes the X86 implementation and improves the AVX1/AVX2 support to correctly lower 256-bit integer vectors.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244949 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-13 20:45:55 +00:00
Davide Italiano
d0a074c824 [SimplifyLibCalls] Correctly set the is_zero_undef flag for llvm.cttz
If <src> is non-zero we can safely set the flag to true, and this
results in less code generated for, e.g. ffs(x) + 1 on FreeBSD.
Thanks to majnemer for suggesting the fix and reviewing.

Code generated before the patch was applied:


 0:   0f bc c7                bsf    %edi,%eax
 3:   b9 20 00 00 00          mov    $0x20,%ecx
 8:   0f 45 c8                cmovne %eax,%ecx
 b:   83 c1 02                add    $0x2,%ecx
 e:   b8 01 00 00 00          mov    $0x1,%eax
13:   85 ff                   test   %edi,%edi
15:   0f 45 c1                cmovne %ecx,%eax
18:   c3                      retq

Code generated after the patch was applied:

 0:   0f bc cf                bsf    %edi,%ecx
 3:   83 c1 02                add    $0x2,%ecx
 6:   85 ff                   test   %edi,%edi
 8:   b8 01 00 00 00          mov    $0x1,%eax
 d:   0f 45 c1                cmovne %ecx,%eax
10:   c3                      retq

It seems we can still use cmove and save another 'test' instruction, but
that can be tackled separately.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244947 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-13 20:34:26 +00:00
Alex Lorenz
4154d8aaa9 MIR Parser: Extract the code that parses the alignment into a new method. NFC.
This commit extracts the code that parses the memory operand's alignment into
a new method named 'parseAlignment' so that it can be reused when parsing the
basic block's alignment attribute.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244945 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-13 20:33:33 +00:00
Simon Pilgrim
d85f3b303d [X86][SSE] Tests for SMAX/SMIN/UMAX/UMIN vector instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244944 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-13 20:31:03 +00:00
Alex Lorenz
6893a81292 MIR Parser: Rename the method 'diagFromLLVMAssemblyDiag'. NFC.
This commit renames the method 'diagFromLLVMAssemblyDiag' to
'diagFromBlockStringDiag'. This method will be used when converting diagnostics
from other YAML block strings, and not just the LLVM module block string, so
the new name should reflect that.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244943 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-13 20:30:11 +00:00
Jingyue Wu
a49e11047c [SeparateConstOffsetFromGEP] strengthen the inbounds attribute
We used to be over-conservative about preserving inbounds. Actually, the second
GEP (which applies the constant offset) can inherit the inbounds attribute of
the original GEP, because the resultant pointer is equivalent to that of the
original GEP. For example,

  x  = GEP inbounds a, i+5
    =>
  y = GEP a, i               // inbounds removed
  x = GEP inbounds y, 5      // inbounds preserved



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244937 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-13 18:48:49 +00:00
David Majnemer
218b64b5ae [llvm-cxxdump] Correctly process relocations when given multiple files
Archive files wouldn't lead to us reprocessing the section relocations
for the new object files.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244932 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-13 18:31:43 +00:00
Yaron Keren
4b885ee8e2 Remove and forbid raw_svector_ostream::flush() calls.
After r244870 flush() will only compare two null pointers and return,
doing nothing but wasting run time. The call is not required any more
as the stream and its SmallString are always in sync.

Thanks to David Blaikie for reviewing.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244928 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-13 18:12:56 +00:00
Nick Lewycky
34509ffd82 Fix GCC warning: extra `;' [-Wpedantic].
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244924 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-13 18:10:19 +00:00
Nemanja Ivanovic
31f6eee816 Scalar to vector conversions using direct moves
This patch corresponds to review:
http://reviews.llvm.org/D11471

It improves the code generated for converting a scalar to a vector value. With
direct moves from GPRs to VSRs, we no longer require expensive stack operations
for this. Subsequent patches will handle the reverse case and more general
operations between vectors and their scalar elements.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244921 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-13 17:40:44 +00:00