oota-llvm.git
9 years ago[x86] fix allowsMisalignedMemoryAccess() implementation
Sanjay Patel [Fri, 14 Aug 2015 17:53:40 +0000 (17:53 +0000)]
[x86] fix allowsMisalignedMemoryAccess() implementation

This patch fixes the x86 implementation of allowsMisalignedMemoryAccess() to correctly
return the 'Fast' output parameter for 32-byte accesses. To test that, an existing load
merging optimization is changed to use the TLI hook. This exposes a shortcoming in the
current logic and results in the regression test update. Changing other direct users of
the isUnalignedMem32Slow() x86 CPU attribute would be a follow-on patch.

Without the fix in allowsMisalignedMemoryAccesses(), we will infinite loop when targeting
SandyBridge because LowerINSERT_SUBVECTOR() creates 32-byte loads from two 16-byte loads
while PerformLOADCombine() splits them back into 16-byte loads.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245075 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[test] Testing write access to llvm
Vedant Kumar [Fri, 14 Aug 2015 17:42:50 +0000 (17:42 +0000)]
[test] Testing write access to llvm

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245074 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[sancov] Fix an unused variable warning introduced in r245067
Justin Bogner [Fri, 14 Aug 2015 17:03:45 +0000 (17:03 +0000)]
[sancov] Fix an unused variable warning introduced in r245067

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245072 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoReverting patch r244235.
Kit Barton [Fri, 14 Aug 2015 16:54:32 +0000 (16:54 +0000)]
Reverting patch r244235.

This patch will be redone in a different way. See
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20150810/292978.html
for more details.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245071 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[cmake] Start adding support for LLVM_USE_SANITIZER=Address on Windows
Reid Kleckner [Fri, 14 Aug 2015 16:48:34 +0000 (16:48 +0000)]
[cmake] Start adding support for LLVM_USE_SANITIZER=Address on Windows

Pass "-fsanitize=address" to the compiler and "-debug" to the linker.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245070 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[sancov] Leave llvm.localescape in the entry block
Reid Kleckner [Fri, 14 Aug 2015 16:45:42 +0000 (16:45 +0000)]
[sancov] Leave llvm.localescape in the entry block

Summary: Similar to the change we applied to ASan. The same test case works.

Reviewers: samsonov

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245067 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoCleanup test whitespace or lack thereof. NFC.
Chad Rosier [Fri, 14 Aug 2015 16:34:15 +0000 (16:34 +0000)]
Cleanup test whitespace or lack thereof. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245065 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[CMake] Fix PR14200, llvm-config output misses -fno-rtti
Chris Bieneman [Fri, 14 Aug 2015 16:20:31 +0000 (16:20 +0000)]
[CMake] Fix PR14200, llvm-config output misses -fno-rtti

This change adds RTTI and Exception flags to llvm-config's cxxflags. This solution is a minimal patch to solve the issue, and is recommended for the 3.7 release branch. Tom Stellard's outstanding work is the longer term solution.

Patch By: David Wiberg

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245064 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert "Centralize the information about which object format we are using."
Rafael Espindola [Fri, 14 Aug 2015 15:48:41 +0000 (15:48 +0000)]
Revert "Centralize the information about which object format we are using."

This reverts commit r245047.

It was failing on the darwin bots. The problem was that when running

./bin/llc -march=msp430

llc gets to

  if (TheTriple.getTriple().empty())
    TheTriple.setTriple(sys::getDefaultTargetTriple());

Which means that we go with an arch of msp430 but a triple of
x86_64-apple-darwin14.4.0 which fails badly.

That code has to be updated to select a triple based on the value of
march, but that is not a trivial fix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245062 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoConvert tests under MC/ELF from macho-dump to llvm-readobj.
Davide Italiano [Fri, 14 Aug 2015 15:16:37 +0000 (15:16 +0000)]
Convert tests under MC/ELF from macho-dump to llvm-readobj.

Yet another step towards deprecating macho-dump.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245059 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agodon't repeaat function names in comments; NFC
Sanjay Patel [Fri, 14 Aug 2015 15:11:42 +0000 (15:11 +0000)]
don't repeaat function names in comments; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245058 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoCentralize the information about which object format we are using.
Rafael Espindola [Fri, 14 Aug 2015 13:31:17 +0000 (13:31 +0000)]
Centralize the information about which object format we are using.

Other than some places that were handling unknown as ELF, this should
have no change. The test updates are because we were detecting
arm-coff or x86_64-win64-coff as ELF targets before.

It is not clear if the enum should live on the Triple. At least now it lives
in a single location and should be easier to move somewhere else.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245047 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSeparate out BDCE's analysis into a separate DemandedBits analysis.
James Molloy [Fri, 14 Aug 2015 11:09:09 +0000 (11:09 +0000)]
Separate out BDCE's analysis into a separate DemandedBits analysis.

This allows other areas of the compiler to use BDCE's bit-tracking.
NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245039 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRenamed min tests (typo)
Simon Pilgrim [Fri, 14 Aug 2015 11:03:31 +0000 (11:03 +0000)]
Renamed min tests (typo)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245038 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[AArch64] FMINNAN/FMAXNAN on f16 is not legal.
James Molloy [Fri, 14 Aug 2015 09:08:50 +0000 (09:08 +0000)]
[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

9 years ago[PM/AA] Remove two no-op overridden functions that just delegated to the
Chandler Carruth [Fri, 14 Aug 2015 08:39:32 +0000 (08:39 +0000)]
[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

9 years ago[LVer] Remove unused Pass parameter from versionLoop, NFC
Adam Nemet [Fri, 14 Aug 2015 06:30:26 +0000 (06:30 +0000)]
[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

9 years ago[RuntimeDyld] Make sure code-sections aren't under-aligned.
Lang Hames [Fri, 14 Aug 2015 06:26:42 +0000 (06:26 +0000)]
[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

9 years ago[IR] Add token types
David Majnemer [Fri, 14 Aug 2015 05:09:07 +0000 (05:09 +0000)]
[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

9 years agoAdd support for cross block dse.
Karthik Bhat [Fri, 14 Aug 2015 04:17:23 +0000 (04:17 +0000)]
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

9 years ago[PM/AA] Run clang-format over the ObjCARC Alias Analysis code to
Chandler Carruth [Fri, 14 Aug 2015 03:57:00 +0000 (03:57 +0000)]
[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

9 years ago[PM/AA] Don't bother forward declaring Function and Value, just include
Chandler Carruth [Fri, 14 Aug 2015 03:55:36 +0000 (03:55 +0000)]
[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

9 years agoPowerPC: remove dead initialization (NFC)
Saleem Abdulrasool [Fri, 14 Aug 2015 03:48:35 +0000 (03:48 +0000)]
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

9 years ago[PM/AA] Extract the interface for GlobalsModRef into a header along with
Chandler Carruth [Fri, 14 Aug 2015 03:48:20 +0000 (03:48 +0000)]
[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

9 years ago[PM/AA] Hoist the interface to TBAA into a dedicated header along with
Chandler Carruth [Fri, 14 Aug 2015 03:33:48 +0000 (03:33 +0000)]
[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

9 years ago[PM/AA] Run clang-format over TBAA code to normalize the formatting
Chandler Carruth [Fri, 14 Aug 2015 03:26:15 +0000 (03:26 +0000)]
[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

9 years ago[PM/AA] Remove a stray #include that snuck in via copy/paste when
Chandler Carruth [Fri, 14 Aug 2015 03:16:11 +0000 (03:16 +0000)]
[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

9 years ago[PM/AA] Clean up the SCEV-AA comment formatting and typos.
Chandler Carruth [Fri, 14 Aug 2015 03:14:50 +0000 (03:14 +0000)]
[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

9 years ago[PM/AA] Run clang-format over the SCEV-AA code to normalize the
Chandler Carruth [Fri, 14 Aug 2015 03:12:16 +0000 (03:12 +0000)]
[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

9 years ago[PM/AA] Hoist the SCEV-AA interface to its own header and pull the
Chandler Carruth [Fri, 14 Aug 2015 03:11:16 +0000 (03:11 +0000)]
[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

9 years ago[PM/AA] Hoist ScopedNoAliasAA's interface into a header and move the
Chandler Carruth [Fri, 14 Aug 2015 02:55:50 +0000 (02:55 +0000)]
[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

9 years ago[PM/AA] Hoist the value handle definition for CFLAA into the header to
Chandler Carruth [Fri, 14 Aug 2015 02:50:34 +0000 (02:50 +0000)]
[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

9 years ago[PM/AA] Run clang-format over the ScopedNoAliasAA pass prior to making
Chandler Carruth [Fri, 14 Aug 2015 02:46:07 +0000 (02:46 +0000)]
[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

9 years ago[PM/AA] Extract a minimal interface for CFLAA to its own header file.
Chandler Carruth [Fri, 14 Aug 2015 02:42:20 +0000 (02:42 +0000)]
[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

9 years ago[PM/AA] Delete two pointlessly overridden methods on the AA interface by
Chandler Carruth [Fri, 14 Aug 2015 02:16:12 +0000 (02:16 +0000)]
[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

9 years ago[PM/AA] Sink all the actual code from AliasAnalysisCounter back into the
Chandler Carruth [Fri, 14 Aug 2015 02:12:12 +0000 (02:12 +0000)]
[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

9 years ago[PM/AA] Run clang-format over this code to establish a clean baseline
Chandler Carruth [Fri, 14 Aug 2015 02:07:05 +0000 (02:07 +0000)]
[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

9 years ago[PM/AA] Hoist the AA counter pass into a header to match the analysis
Chandler Carruth [Fri, 14 Aug 2015 02:05:41 +0000 (02:05 +0000)]
[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

9 years ago[SeparateConstOffsetFromGEP] sext(a)+sext(b) => sext(a+b) when a+b can't sign-overflow.
Jingyue Wu [Fri, 14 Aug 2015 02:02:05 +0000 (02:02 +0000)]
[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

9 years ago[PM/AA] Remove the function names and class names from doxygen comments
Chandler Carruth [Fri, 14 Aug 2015 01:43:46 +0000 (01:43 +0000)]
[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

9 years ago[PM/AA] Move the LibCall AA creation routine declaration to that
Chandler Carruth [Fri, 14 Aug 2015 01:43:02 +0000 (01:43 +0000)]
[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

9 years ago[PM/AA] Run clang-format over LibCallAliasAnalysis prior to making
Chandler Carruth [Fri, 14 Aug 2015 01:38:25 +0000 (01:38 +0000)]
[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

9 years agoUpdate ExceptionDemo for exception handling API changes (personality function call...
David Blaikie [Fri, 14 Aug 2015 00:37:16 +0000 (00:37 +0000)]
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

9 years agoUpdate MIRLangRef for MIR syntax change from r244982.
Alex Lorenz [Fri, 14 Aug 2015 00:36:10 +0000 (00:36 +0000)]
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

9 years agoFix -Wformat warnings in ExceptionDemo
David Blaikie [Fri, 14 Aug 2015 00:31:49 +0000 (00:31 +0000)]
Fix -Wformat warnings in ExceptionDemo

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244995 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix up the ExceptionDemo for some API changes over the past <time>
David Blaikie [Fri, 14 Aug 2015 00:24:56 +0000 (00:24 +0000)]
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

9 years ago[LIR] Re-instate r244880, reverted in r244884, factoring the handling of
Chandler Carruth [Fri, 14 Aug 2015 00:21:10 +0000 (00:21 +0000)]
[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

9 years agoMIR Serialization: Change MIR syntax - use custom syntax for MBBs.
Alex Lorenz [Thu, 13 Aug 2015 23:10:16 +0000 (23:10 +0000)]
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

9 years agodon't repeat function names in comments; NFC
Sanjay Patel [Thu, 13 Aug 2015 22:53:20 +0000 (22:53 +0000)]
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

9 years ago[IR] Cleanup indentation of EH instructions
David Majnemer [Thu, 13 Aug 2015 22:11:40 +0000 (22:11 +0000)]
[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

9 years ago[AMDGPU] Use the general SMAX/SMIN/UMAX/UMIN pattern matching and remove the AMDGPU...
Simon Pilgrim [Thu, 13 Aug 2015 21:40:02 +0000 (21:40 +0000)]
[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

9 years ago[AArch64] Provide "too few operands" diags on short-form NEON also.
Ahmed Bougacha [Thu, 13 Aug 2015 21:09:13 +0000 (21:09 +0000)]
[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

9 years agoMIR Parser: Don't allow negative alignments for memory operands.
Alex Lorenz [Thu, 13 Aug 2015 20:55:01 +0000 (20:55 +0000)]
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

9 years ago[X86][SSE] Use the general SMAX/SMIN/UMAX/UMIN pattern matching and remove the X86...
Simon Pilgrim [Thu, 13 Aug 2015 20:45:55 +0000 (20:45 +0000)]
[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

9 years ago[SimplifyLibCalls] Correctly set the is_zero_undef flag for llvm.cttz
Davide Italiano [Thu, 13 Aug 2015 20:34:26 +0000 (20:34 +0000)]
[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

9 years agoMIR Parser: Extract the code that parses the alignment into a new method. NFC.
Alex Lorenz [Thu, 13 Aug 2015 20:33:33 +0000 (20:33 +0000)]
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

9 years ago[X86][SSE] Tests for SMAX/SMIN/UMAX/UMIN vector instructions
Simon Pilgrim [Thu, 13 Aug 2015 20:31:03 +0000 (20:31 +0000)]
[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

9 years agoMIR Parser: Rename the method 'diagFromLLVMAssemblyDiag'. NFC.
Alex Lorenz [Thu, 13 Aug 2015 20:30:11 +0000 (20:30 +0000)]
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

9 years ago[SeparateConstOffsetFromGEP] strengthen the inbounds attribute
Jingyue Wu [Thu, 13 Aug 2015 18:48:49 +0000 (18:48 +0000)]
[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

9 years ago[llvm-cxxdump] Correctly process relocations when given multiple files
David Majnemer [Thu, 13 Aug 2015 18:31:43 +0000 (18:31 +0000)]
[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

9 years agoRemove and forbid raw_svector_ostream::flush() calls.
Yaron Keren [Thu, 13 Aug 2015 18:12:56 +0000 (18:12 +0000)]
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

9 years agoFix GCC warning: extra `;' [-Wpedantic].
Nick Lewycky [Thu, 13 Aug 2015 18:10:19 +0000 (18:10 +0000)]
Fix GCC warning: extra `;' [-Wpedantic].

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244924 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoScalar to vector conversions using direct moves
Nemanja Ivanovic [Thu, 13 Aug 2015 17:40:44 +0000 (17:40 +0000)]
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

9 years agoEmit argmemonly attribute for intrinsics.
Igor Laevsky [Thu, 13 Aug 2015 17:40:04 +0000 (17:40 +0000)]
Emit argmemonly attribute for intrinsics.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244920 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[ARM] FMINNAN/FMAXNAN of f64 are not legal.
James Molloy [Thu, 13 Aug 2015 17:28:26 +0000 (17:28 +0000)]
[ARM] FMINNAN/FMAXNAN of f64 are not legal.

This was my error. We've got f32 marked as legal because they're simulated using a v2f32 instruction, but there's no equivalent for f64.

This will get test coverage imminently when D12015 lands.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244916 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[ARM] Allow vmin/vmax of scalars to be emitted without UseNEONForFP.
James Molloy [Thu, 13 Aug 2015 17:28:20 +0000 (17:28 +0000)]
[ARM] Allow vmin/vmax of scalars to be emitted without UseNEONForFP.

This overrides the default to more closely resemble the hand-crafted matching logic in ISelLowering. It makes sense, as there is no VFP equivalent of vmin or vmax, to use them when they're available even if in general VFP ops should be preferred.

This should be NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244915 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[ARM] Rejig vmax tests a bit
James Molloy [Thu, 13 Aug 2015 17:28:16 +0000 (17:28 +0000)]
[ARM] Rejig vmax tests a bit

They rely on global fast-math options, but soon ISel will rely only on fast-math flags on the instructions themselves. Rip the fast checks out into their own file so we can mark their instructions as fast.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244914 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[AArch64] Small rejig of fmax tests, NFCI.
James Molloy [Thu, 13 Aug 2015 17:28:10 +0000 (17:28 +0000)]
[AArch64] Small rejig of fmax tests, NFCI.

These tests relied on -enable-no-nans-fp-math, whereas soon they'll take their no-nans hint
from the FCMP instruction itself, so split the no-nans stuff out into its own test.

Also do a slight rejig of instruction order. The old FMIN/MAX backend matching had to deal with looking through casts, which it never did particularly well. Now, instcombine will recognize such patterns and canonicalize the cast outside the select. So modify the test inputs to assume that instcombine has already run.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244913 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[DeadStoreElimination] remove a redundant store even if the load is in a different...
Erik Eckstein [Thu, 13 Aug 2015 15:36:11 +0000 (15:36 +0000)]
[DeadStoreElimination] remove a redundant store even if the load is in a different block.

DeadStoreElimination does eliminate a store if it stores a value which was loaded from the same memory location.
So far this worked only if the store is in the same block as the load.
Now we can also handle stores which are in a different block than the load.
Example:

define i32 @test(i1, i32*) {
entry:
  %l2 = load i32, i32* %1, align 4
  br i1 %0, label %bb1, label %bb2
bb1:
  br label %bb3
bb2:
  ; This store is redundant
  store i32 %l2, i32* %1, align 4
  br label %bb3
bb3:
  ret i32 0
}

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244901 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[mips][mcjit] Calculate correct addend for HI16 and PCHI16 reloc
Petar Jovanovic [Thu, 13 Aug 2015 15:12:49 +0000 (15:12 +0000)]
[mips][mcjit] Calculate correct addend for HI16 and PCHI16 reloc

Previously, for O32 ABI we did not calculate correct addend for R_MIPS_HI16
and R_MIPS_PCHI16 relocations. This patch fixes that.

Patch by Vladimir Radosavljevic.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244897 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[WinEHPrepare] Update demotion logic
Joseph Tremoulet [Thu, 13 Aug 2015 14:30:10 +0000 (14:30 +0000)]
[WinEHPrepare] Update demotion logic

Summary:
Update the demotion logic in WinEHPrepare to avoid creating new cleanups by
walking predecessors as necessary to insert stores for EH-pad PHIs.

Also avoid creating stores for EH-pad PHIs that have no uses.

The store/load placement is still pretty naive.  Likely future improvements
(at least for optimized compiles) include:
 - Share loads for related uses as possible
 - Coalesce non-interfering use/def-related PHIs
 - Store at definition point rather than each PHI pred for non-interfering
   lifetimes.

Reviewers: rnk, majnemer

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244894 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[SystemZ] Support large LLVM IR struct return values
Ulrich Weigand [Thu, 13 Aug 2015 13:37:06 +0000 (13:37 +0000)]
[SystemZ] Support large LLVM IR struct return values

Recent mesa/llvmpipe crashes on SystemZ due to a failed assertion when
attempting to compile a routine with a return type of
  { <4 x float>, <4 x float>, <4 x float>, <4 x float> }
on a system without vector instruction support.

This is because after legalizing the vector type, we get a return value
consisting of 16 floats, which cannot all be returned in registers.

Usually, what should happen in this case is that the target's CanLowerReturn
routine rejects the return type, in which case SelectionDAG falls back to
implementing a structure return in memory via implicit reference.

However, the SystemZ target never actually implemented any CanLowerReturn
routine, and thus would accept any struct return type.

This patch fixes the crash by implementing CanLowerReturn.  As a side effect,
this also handles fp128 return values, fixing a todo that was noted in
SystemZCallingConv.td.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244889 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRemove raw_svector_ostream::resync and users. It's no-op after r244870.
Yaron Keren [Thu, 13 Aug 2015 12:42:25 +0000 (12:42 +0000)]
Remove raw_svector_ostream::resync and users. It's no-op after r244870.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244888 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[InstCombinePHI] Partial simplification of identity operations.
Charlie Turner [Thu, 13 Aug 2015 12:38:58 +0000 (12:38 +0000)]
[InstCombinePHI] Partial simplification of identity operations.

Consider this code:

BB:
  %i = phi i32 [ 0, %if.then ], [ %c, %if.else ]
  %add = add nsw i32 %i, %b
  ...

In this common case the add can be moved to the %if.else basic block, because
adding zero is an identity operation. If we go though %if.then branch it's
always a win, because add is not executed; if not, the number of instructions
stays the same.

This pattern applies also to other instructions like sub, shl, shr, ashr | 0,
mul, sdiv, div | 1.

Patch by Jakub Kuderski!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244887 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert "[LIR] Start leveraging the fundamental guarantees of a loop..."
Renato Golin [Thu, 13 Aug 2015 11:25:38 +0000 (11:25 +0000)]
Revert "[LIR] Start leveraging the fundamental guarantees of a loop..."

This reverts commit r244879, as it broke the test-suite on
SingleSource/Regression/C/2004-03-15-IndirectGoto in AArch64.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244885 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert "[LIR] Handle access to AliasAnalysis the same way as the other analysis in...
Renato Golin [Thu, 13 Aug 2015 11:25:35 +0000 (11:25 +0000)]
Revert "[LIR] Handle access to AliasAnalysis the same way as the other analysis in LoopIdiomRecognize."

This reverts commit r244880, as it broke the test-suite on
SingleSource/Regression/C/2004-03-15-IndirectGoto in AArch64.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244884 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoTest Commit.
Ashutosh Nema [Thu, 13 Aug 2015 11:18:35 +0000 (11:18 +0000)]
Test Commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244883 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[ARM] Reorganise and simplify thumb-1 load/store selection
John Brawn [Thu, 13 Aug 2015 10:48:22 +0000 (10:48 +0000)]
[ARM] Reorganise and simplify thumb-1 load/store selection

Other than PC-relative loads/store the patterns that match the various
load/store addressing modes have the same complexity, so the order that they
are matched is the order that they appear in the .td file.

Rearrange the instruction definitions in ARMInstrThumb.td, and make use of
AddedComplexity for PC-relative loads, so that the instruction matching order
is the order that results in the simplest selection logic. This also makes
register-offset load/store be selected when it should, as previously it was
only selected for too-large immediate offsets.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244882 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[LIR] Handle access to AliasAnalysis the same way as the other analysis
Chandler Carruth [Thu, 13 Aug 2015 10:00:53 +0000 (10:00 +0000)]
[LIR] Handle access to AliasAnalysis the same way as the other analysis
in LoopIdiomRecognize. This is what started me staring at this code. Now
migrating it with the new AA stuff will be trivial.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244880 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[LIR] Start leveraging the fundamental guarantees of a loop in
Chandler Carruth [Thu, 13 Aug 2015 09:56:20 +0000 (09:56 +0000)]
[LIR] Start leveraging the fundamental guarantees of a loop in
simplified form to remove redundant checks and simplify the code for
popcount recognition. We don't actually need to handle all of these
cases.

I've left a FIXME for one in particular until I finish inspecting to
make sure we don't actually *rely* on the predicate in any way.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244879 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[LIR] Handle the LoopInfo the same as all the other analyses. No utility
Chandler Carruth [Thu, 13 Aug 2015 09:27:01 +0000 (09:27 +0000)]
[LIR] Handle the LoopInfo the same as all the other analyses. No utility
really in breaking pattern just for this analysis.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244878 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[InstCombine] SSE/AVX vector shifts demanded shift amount bits
Simon Pilgrim [Thu, 13 Aug 2015 07:39:03 +0000 (07:39 +0000)]
[InstCombine] SSE/AVX vector shifts demanded shift amount bits

Most SSE/AVX (non-constant) vector shift instructions only use the lower 64-bits of the 128-bit shift amount vector operand, this patch calls SimplifyDemandedVectorElts to optimize for this.

I had to refactor some of my recent InstCombiner work on the vector shifts to avoid quite a bit of duplicate code, it means that SimplifyX86immshift now (re)decodes the type of shift.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244872 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoModify raw_svector_ostream to use its SmallString without additional buffering.
Yaron Keren [Thu, 13 Aug 2015 06:19:52 +0000 (06:19 +0000)]
Modify raw_svector_ostream to use its SmallString without additional buffering.
This is faster and avoids the stream and SmallString state synchronization issue.
resync() is a no-op and may be safely deleted.  I'll do so in a follow-up commit.

Reviewed by Rafael Espindola.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244870 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[LoopUnswitch] Check OptimizeForSize before traversing over all basic blocks in curre...
Chen Li [Thu, 13 Aug 2015 05:24:29 +0000 (05:24 +0000)]
[LoopUnswitch] Check OptimizeForSize before traversing over all basic blocks in current loop

Summary: This patch moves the check of OptimizeForSize before traversing over all basic blocks in current loop. If OptimizeForSize is set to true, no non-trivial unswitch is ever allowed. Therefore, the early exit will help reduce compilation time. This patch should be NFC.

Reviewers: reames, weimingz, broune

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244868 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[CodeGen] Mark the promoted FCOPYSIGN result FP_ROUND as TRUNCating.
Ahmed Bougacha [Thu, 13 Aug 2015 01:32:30 +0000 (01:32 +0000)]
[CodeGen] Mark the promoted FCOPYSIGN result FP_ROUND as TRUNCating.

Now that we can properly promote mismatched FCOPYSIGNs (r244858), we
can mark the FP_ROUND on the result as truncating, to expose folding.

FCOPYSIGN doesn't change anything but the sign bit, so
  (fp_round (fcopysign (fpext a), b))
is equivalent to (modulo the sign bit):
  (fp_round (fpext a))
which is a no-op.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244862 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[AArch64] Cleanup vector-fcopysign.ll test. NFC.
Ahmed Bougacha [Thu, 13 Aug 2015 01:20:38 +0000 (01:20 +0000)]
[AArch64] Cleanup vector-fcopysign.ll test. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244861 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[AArch64] Also custom-lowering mismatched vector/f16 FCOPYSIGN.
Ahmed Bougacha [Thu, 13 Aug 2015 01:13:56 +0000 (01:13 +0000)]
[AArch64] Also custom-lowering mismatched vector/f16 FCOPYSIGN.

We can lower them using our cool tricks if we fpext/fptrunc the second
input, like we do for f32/f64.

Follow-up to r243924, r243926, and r244858.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244860 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[CodeGen] Assert on getNode(FP_EXTEND) with a smaller dst type.
Ahmed Bougacha [Thu, 13 Aug 2015 01:10:29 +0000 (01:10 +0000)]
[CodeGen] Assert on getNode(FP_EXTEND) with a smaller dst type.

This would have caught the problem in r244858.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244859 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[CodeGen] When Promoting, don't extend the 2nd FCOPYSIGN operand.
Ahmed Bougacha [Thu, 13 Aug 2015 01:09:43 +0000 (01:09 +0000)]
[CodeGen] When Promoting, don't extend the 2nd FCOPYSIGN operand.

We don't care about its type, and there's even a combine that'll fold
away the FP_EXTEND if we let it run. However, until it does, we'll have
something broken like:
  (f32 (fp_extend (f64 v)))

Scalar f16 follow-up to r243924.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244858 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[CodeGen] Simplify getNode(*EXT/TRUNC) type size assert. NFC.
Ahmed Bougacha [Thu, 13 Aug 2015 01:08:48 +0000 (01:08 +0000)]
[CodeGen] Simplify getNode(*EXT/TRUNC) type size assert. NFC.

We already check that vectors have the same number of elements, we
don't need to use the scalar types explicitly: comparing the size of
the whole vector is enough.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244857 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoThere is only one saver of strings.
Rafael Espindola [Thu, 13 Aug 2015 01:07:02 +0000 (01:07 +0000)]
There is only one saver of strings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244854 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[LIR] Make the LoopIdiomRecognize pass get analyses essentially the same
Chandler Carruth [Thu, 13 Aug 2015 01:03:26 +0000 (01:03 +0000)]
[LIR] Make the LoopIdiomRecognize pass get analyses essentially the same
way as every other pass. This simplifies the code quite a bit and is
also more idiomatic! <ba-dum!>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244853 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[LIR] Remove the dedicated class for popcount recognition and sink the
Chandler Carruth [Thu, 13 Aug 2015 00:44:29 +0000 (00:44 +0000)]
[LIR] Remove the dedicated class for popcount recognition and sink the
code into methods on LoopIdiomRecognize.

This simplifies the code somewhat and also makes it much easier to move
the analyses around. Ultimately, the separate class wasn't providing
significant value over methods -- it contained the precondition basic
block and the current loop. The current loop is already available and
the precondition block wasn't needed everywhere and is easy to pass
around.

In several cases I just moved things to be static functions because they
already accepted most of their inputs as arguments.

This doesn't fix the way we manage analyses yet, that will be the next
patch, but it already makes the code over 50 lines shorter.

No functionality changed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244851 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoReturn ErrorOr from FileOutputBuffer::create. NFC.
Rafael Espindola [Thu, 13 Aug 2015 00:31:39 +0000 (00:31 +0000)]
Return ErrorOr from FileOutputBuffer::create. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244848 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[WebAssembly] Declare the llvm.wasm.page.size() intrinsic.
Dan Gohman [Thu, 13 Aug 2015 00:26:04 +0000 (00:26 +0000)]
[WebAssembly] Declare the llvm.wasm.page.size() intrinsic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244847 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[LIR] Move all the helpers to be private and re-order the methods in
Chandler Carruth [Thu, 13 Aug 2015 00:10:03 +0000 (00:10 +0000)]
[LIR] Move all the helpers to be private and re-order the methods in
a way that groups things logically. No functionality changed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244845 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoTest Commit - Corrected spelling in README.txt.
Steve King [Wed, 12 Aug 2015 23:56:50 +0000 (23:56 +0000)]
Test Commit - Corrected spelling in README.txt.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244842 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[LIR] Remove the 'LIRUtils' abstraction which was unnecessary and adding
Chandler Carruth [Wed, 12 Aug 2015 23:55:56 +0000 (23:55 +0000)]
[LIR] Remove the 'LIRUtils' abstraction which was unnecessary and adding
complexity.

There is only one function that was called from multiple locations, and
that was 'getBranch' which has a reasonable one-line spelling already:
dyn_cast<BranchInst>(BB->getTerminator). We could make this shorter, but
it doesn't seem to add much value. Instead, we should avoid calling it
so many times on the same basic blocks, but that will be in a subsequent
patch.

The other functions are only called in one location, so inline them
there, and take advantage of this to use direct early exit and reduce
indentation. This makes it much more clear what is being tested for, and
in fact makes it clear now to me that there are simpler ways to do this
work. However, this patch just does the mechanical inlining. I'll clean
up the functionality of the code to leverage loop simplified form more
effectively in a follow-up.

Despite lots of early line breaks due to early-exit, this is still
shorter than it was before.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244841 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSimplify PackedVector by removing user-defined special members that aren't any differ...
David Blaikie [Wed, 12 Aug 2015 23:26:12 +0000 (23:26 +0000)]
Simplify PackedVector by removing user-defined special members that aren't any different than the defaults

This causes the other special members (like move and copy construction,
and move assignment) to come through for free. Some code in clang was
depending on the (deprecated, in the original code) copy ctor. Now that
there's no user-defined special members, they're all available without
any deprecation concerns.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244835 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoIRBuilder: Use move semantics for the IRBuilderInserter parameter
David Blaikie [Wed, 12 Aug 2015 23:18:49 +0000 (23:18 +0000)]
IRBuilder: Use move semantics for the IRBuilderInserter parameter

Just drive by cleanup while fixing -Wdeprecated warnings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244832 91177308-0d34-0410-b5e6-96231b3b80d8