oota-llvm.git
6 years ago[Orc] Enable user-supplied memory managers in the CompileOnDemand layer.
Lang Hames [Sat, 9 Jan 2016 20:55:18 +0000 (20:55 +0000)]
[Orc] Enable user-supplied memory managers in the CompileOnDemand layer.

Previously the CompileOnDemand layer was hard-coded to use a new
SectionMemoryManager for each function when it was called.

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

6 years ago[X86][AVX] Add support for i64 broadcast loads on 32-bit targets
Simon Pilgrim [Sat, 9 Jan 2016 19:59:27 +0000 (19:59 +0000)]
[X86][AVX] Add support for i64 broadcast loads on 32-bit targets

Added 32-bit AVX1/AVX2 broadcast tests.

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

6 years ago[Orc][RuntimeDyld] Prevent duplicate calls to finalizeMemory on shared memory
Lang Hames [Sat, 9 Jan 2016 19:50:40 +0000 (19:50 +0000)]
[Orc][RuntimeDyld] Prevent duplicate calls to finalizeMemory on shared memory
managers.

Prior to this patch, recursive finalization (where finalization of one
RuntimeDyld instance triggers finalization of another instance on which the
first depends) could trigger memory access failures: When the inner (dependent)
RuntimeDyld instance and its memory manager are finalized, memory allocated
(but not yet relocated) by the outer instance is locked, and relocation in the
outer instance fails with a memory access error.

This patch adds a latch to the RuntimeDyld::MemoryManager base class that is
checked by a new method: RuntimeDyld::finalizeWithMemoryManagerLocking, ensuring
that shared memory managers are only finalized by the outermost RuntimeDyld
instance.

This allows ORC clients to supply the same memory manager to multiple calls to
addModuleSet. In particular it enables the use of user-supplied memory managers
with the CompileOnDemandLayer which must reuse the supplied memory manager for
each function that is lazily compiled.

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

6 years ago[JumpThreading] Use range-based for loops.
Benjamin Kramer [Sat, 9 Jan 2016 18:43:01 +0000 (18:43 +0000)]
[JumpThreading] Use range-based for loops.

No functionality change intended.

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

6 years ago[TRE] Simplify code with range-based loops and std::find.
Benjamin Kramer [Sat, 9 Jan 2016 17:35:29 +0000 (17:35 +0000)]
[TRE] Simplify code with range-based loops and std::find.

No functional change intended.

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

6 years ago[BranchFolding] Set correct mem refs
Junmo Park [Sat, 9 Jan 2016 07:30:13 +0000 (07:30 +0000)]
[BranchFolding] Set correct mem refs

Merge MBBICommon and MBBI's MMOs.

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

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

6 years ago[RS4GC] Update and simplify handling of Constants in findBaseDefiningValueOfVector().
Manuel Jacob [Sat, 9 Jan 2016 04:02:16 +0000 (04:02 +0000)]
[RS4GC] Update and simplify handling of Constants in findBaseDefiningValueOfVector().

Summary:
This is analogous to r256079, which removed an overly strong assertion, and
r256812, which simplified the code by replacing three conditionals by one.

Reviewers: reames

Subscribers: sanjoy, llvm-commits

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

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

6 years ago[libFuzzer] debug prints in tracing
Kostya Serebryany [Sat, 9 Jan 2016 03:46:08 +0000 (03:46 +0000)]
[libFuzzer] debug prints in tracing

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

6 years ago[libFuzzer] change the way trace-based mutations are applied. Instead of a custom...
Kostya Serebryany [Sat, 9 Jan 2016 03:08:58 +0000 (03:08 +0000)]
[libFuzzer] change the way trace-based mutations are applied. Instead of a custom code just rely on the automatically created dictionary

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

6 years ago[RS4GC] Unify two asserts. NFC.
Manuel Jacob [Sat, 9 Jan 2016 03:08:49 +0000 (03:08 +0000)]
[RS4GC] Unify two asserts.  NFC.

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

6 years ago[libFuzzer] don't limit memcmp tracing with 8 bytes
Kostya Serebryany [Sat, 9 Jan 2016 01:39:55 +0000 (01:39 +0000)]
[libFuzzer] don't limit memcmp tracing with 8 bytes

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

6 years ago[rs4gc] Optionally directly relocated vector of pointers
Philip Reames [Sat, 9 Jan 2016 01:31:13 +0000 (01:31 +0000)]
[rs4gc] Optionally directly relocated vector of pointers

This patch teaches rewrite-statepoints-for-gc to relocate vector-of-pointers directly rather than trying to split them. This builds on the recent lowering/IR changes to allow vector typed gc.relocates.

The motivation for this is that we recently found a bug in the vector splitting code where depending on visit order, a vector might not be relocated at some safepoint. Specifically, the bug is that the splitting code wasn't updating the side tables (live vector) of other safepoints. As a result, a vector which was live at two safepoints might not be updated at one of them. However, if you happened to visit safepoints in post order over the dominator tree, everything worked correctly. Weirdly, it turns out that post order is actually an incredibly common order to visit instructions in in practice. Frustratingly, I have not managed to write a test case which actually hits this. I can only reproduce it in large IR files produced by actual applications.

Rather than continue to make this code more complicated, we can remove all of the complexity by just representing the relocation of the entire vector natively in the IR.

At the moment, the new functionality is hidden behind a flag. To use this code, you need to pass "-rs4gc-split-vector-values=0". Once I have a chance to stress test with this option and get feedback from other users, my plan is to flip the default and remove the original splitting code. I would just remove it now, but given the rareness of the bug, I figured it was better to leave it in place until the new approach has been stress tested.

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

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

6 years ago[libFuzzer] refactor the way we collect cmp traces (don't use std::vector, don't...
Kostya Serebryany [Sat, 9 Jan 2016 00:38:40 +0000 (00:38 +0000)]
[libFuzzer] refactor the way we collect cmp traces (don't use std::vector, don't limit with 8 bytes)

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

6 years agofixing type.
Mike Aizatsky [Sat, 9 Jan 2016 00:31:56 +0000 (00:31 +0000)]
fixing type.

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

6 years agollvm/lib/DebugInfo/Symbolize/DIPrinter.cpp: Fix build in -m32. 1L is incompatible...
NAKAMURA Takumi [Sat, 9 Jan 2016 00:28:50 +0000 (00:28 +0000)]
llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp: Fix build in -m32. 1L is incompatible to int64_t.

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

6 years ago[llvm-symbolizer] -print-source-context-lines option to print source code around...
Mike Aizatsky [Sat, 9 Jan 2016 00:14:35 +0000 (00:14 +0000)]
[llvm-symbolizer] -print-source-context-lines option to print source code around the line.

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

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

6 years agodon't repeat variable/function names in comments; NFC
Sanjay Patel [Fri, 8 Jan 2016 23:04:05 +0000 (23:04 +0000)]
don't repeat variable/function names in comments; NFC

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

6 years agorangify; NFCI
Sanjay Patel [Fri, 8 Jan 2016 22:59:42 +0000 (22:59 +0000)]
rangify; NFCI

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

6 years ago[PGO] Introducing version mask macro/NFC
Xinliang David Li [Fri, 8 Jan 2016 22:55:16 +0000 (22:55 +0000)]
[PGO] Introducing version mask macro/NFC

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

6 years agoTeach the CMake build system to run lit's test suite. These can be run
Dan Liew [Fri, 8 Jan 2016 22:36:22 +0000 (22:36 +0000)]
Teach the CMake build system to run lit's test suite. These can be run
directy with ``make check-lit`` and are run as part of
``make check-all``.

In principle we should run lit's testsuite before testing LLVM using lit
so that any problems with lit get discovered before testing LLVM so we
can bail out early.  However this implementation (``check-all`` runs all
tests together) seemed simpler and will still report failing lit tests.

Note that the tests and the configured ``lit.site.cfg`` have to be
copied into the build directory to avoid polluting the source tree.

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

6 years ago[Hexagon] Replace a static member variable in HexagonCVIResource (NFC)
Tobias Edler von Koch [Fri, 8 Jan 2016 22:07:25 +0000 (22:07 +0000)]
[Hexagon] Replace a static member variable in HexagonCVIResource (NFC)

This creates one instance of TUL per HexagonShuffler, which avoids thread-safety
issues with future changes.

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

6 years agovariable names start with an upper case letter; NFC
Sanjay Patel [Fri, 8 Jan 2016 22:05:03 +0000 (22:05 +0000)]
variable names start with an upper case letter; NFC

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

6 years ago[DAGCombiner] don't dereference an operand that doesn't exist (PR26070)
Sanjay Patel [Fri, 8 Jan 2016 19:53:24 +0000 (19:53 +0000)]
[DAGCombiner] don't dereference an operand that doesn't exist (PR26070)

The bug was introduced with changes for x86-64 fp128:
http://reviews.llvm.org/rL254653

I don't know why an x86 change is here, so I'll follow up in:
http://reviews.llvm.org/D15134

Should fix:
https://llvm.org/bugs/show_bug.cgi?id=26070

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

6 years ago[JumpThreading] Split select that has constant conditions coming from the PHI node
Haicheng Wu [Fri, 8 Jan 2016 19:39:39 +0000 (19:39 +0000)]
[JumpThreading] Split select that has constant conditions coming from the PHI node

Look for PHI/Select in the same BB of the form

bb:
  %p = phi [false, %bb1], [true, %bb2], [false, %bb3], [true, %bb4], ...
  %s = select p, trueval, falseval

And expand the select into a branch structure. This later enables
jump-threading over bb in this pass.

Using the similar approach of SimplifyCFG::FoldCondBranchOnPHI(), unfold
select if the associated PHI has at least one constant.  If the unfolded
select is not jump-threaded, it will be folded again in the later
optimizations.

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

6 years agoLiveInterval: Adapt commen to the LI->LR change.
Matthias Braun [Fri, 8 Jan 2016 19:25:31 +0000 (19:25 +0000)]
LiveInterval: Adapt commen to the LI->LR change.

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

6 years agoMinor fix -- use the right version enum/NFC
Xinliang David Li [Fri, 8 Jan 2016 19:21:32 +0000 (19:21 +0000)]
Minor fix -- use the right version enum/NFC

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

6 years agoTest commit access - add a blank line in comment.
Tim Shen [Fri, 8 Jan 2016 19:20:23 +0000 (19:20 +0000)]
Test commit access - add a blank line in comment.

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

6 years agoLoopInfo: Simplify ownership of Loop objects
Justin Bogner [Fri, 8 Jan 2016 19:08:53 +0000 (19:08 +0000)]
LoopInfo: Simplify ownership of Loop objects

It's strange that LoopInfo mostly owns the Loop objects, but that it
defers deleting them to the loop pass manager. Instead, change the
oddly named "updateUnloop" to "markAsRemoved" and have it queue the
Loop object for deletion. We can't delete the Loop immediately when we
remove it, since we need its pointer identity still, so we'll mark the
object as "invalid" so that clients can see what's going on.

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

6 years agoRBIT Instruction only available for ARMv6t2 and above.
Weiming Zhao [Fri, 8 Jan 2016 18:43:41 +0000 (18:43 +0000)]
RBIT Instruction only available for ARMv6t2 and above.

Summary:
r255334 matches bit-reverse pattern in InstCombine and generates calls to Instrinsic::bitreverse.

RBIT instruction is only available for ARMv6t2 and above. This patch has the intrinsic expanded during legalization for ARMv4 and ARMv5.

Patch by Z. Zheng <zhaoshiz@codeaurora.org>

Reviewers: apazos, jmolloy, weimingz

Subscribers: aemerson, rengolin, llvm-commits

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

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

6 years agoDisable shrink-wrap for Thumb1
Weiming Zhao [Fri, 8 Jan 2016 18:37:43 +0000 (18:37 +0000)]
Disable shrink-wrap for Thumb1

Summary: In ARMConstantIslandPass, which runs after Shrink Wrap pass, long jumps will be fixed up as BL (tBfar) which depends on spilling LR in epilogue.  However, shrink-wrap may remove the LR, which causes issues when the function returns.

Reviewers: qcolombet, rengolin

Subscribers: aemerson, rengolin

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

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

6 years agoRemove CloningDirector and associated code
Easwaran Raman [Fri, 8 Jan 2016 18:23:17 +0000 (18:23 +0000)]
Remove CloningDirector and associated code

With the removal of the old landing pad code in r249918, CloningDirector is not
 used anywhere else. NFCI.

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

6 years agoDo not ASSERTZEXT for i16 result of bitcast from f16 operand
Pirama Arumuga Nainar [Fri, 8 Jan 2016 17:46:05 +0000 (17:46 +0000)]
Do not ASSERTZEXT for i16 result of bitcast from f16 operand

Summary:
During legalization if i16, do not ASSERTZEXT the result of FP_TO_FP16.
Directly return an FP_TO_FP16 node with return type as the
promote-to-type of i16.

This patch also removes extraneous length check.  This legalization
should be valid even if integer and float types are of different
lengths.

This patch breaks a hard-float test for fp16 args.  The test is changed
to allow a vmov to zero-out the top bits, and also ensure that the
return value is in an FP register.

Reviewers: ab, jmolloy

Subscribers: srhines, llvm-commits

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

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

6 years ago[WinEH] CatchHandler which don't have catch objects in StackColoring
David Majnemer [Fri, 8 Jan 2016 17:24:47 +0000 (17:24 +0000)]
[WinEH] CatchHandler which don't have catch objects in StackColoring

StackColoring rewrites the frame indicies of operations involving
allocas if it can find that the life time of two objects do not overlap.
MSVC EH needs to be kept aware of this if happens in the event that a
catch object has moved around.  However, we represent the non-existance
of a catch object with a sentinel frame index (INT_MAX).  This sentinel
also happens to be the EmptyKey of the SlotRemap DenseMap.  Testing for
whether or not we need to translate the frame index fails in this case
because we call the count method on the DenseMap with the EmptyKey,
leading to assertions.  Instead, check if it is our sentinel value
before trying to look into the DenseMap.

This fixes PR26073.

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

6 years ago[ThinLTO] Use new in-place symbol changes for exporting module
Teresa Johnson [Fri, 8 Jan 2016 17:06:29 +0000 (17:06 +0000)]
[ThinLTO] Use new in-place symbol changes for exporting module

Due to the new in-place ThinLTO symbol handling support added in
r257174, we now invoke renameModuleForThinLTO on the current
module from within the FunctionImport pass.

Additionally, renameModuleForThinLTO no longer needs to return the
Module as it is performing the renaming in place on the one provided.

This commit will be immediately preceeded by a companion clang patch to
remove its invocation of renameModuleForThinLTO.

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

6 years agoHow to close a review manually.
Paul Robinson [Fri, 8 Jan 2016 17:05:12 +0000 (17:05 +0000)]
How to close a review manually.

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

6 years ago[ThinLTO] Enable in-place symbol changes for exporting module
Teresa Johnson [Fri, 8 Jan 2016 15:00:00 +0000 (15:00 +0000)]
[ThinLTO] Enable in-place symbol changes for exporting module

Summary:
Move ThinLTO global value processing functions out of ModuleLinker and
into a new ThinLTOGlobalProcessor class, which performs any necessary
linkage and naming changes on the given module in place.

As a result, renameModuleForThinLTO no longer needs to create a new
Module when performing any necessary local to global promotion on a
module that we are possibly exporting from during a ThinLTO backend
compilation.

During function importing the ThinLTO processing is still invoked from
the ModuleLinker (via the new class), as it needs to perform renaming and
linkage changes on the source module, e.g. in order to get the correct
renaming during local to global promotion.

Reviewers: joker.eph

Subscribers: davidxl, llvm-commits, joker.eph

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

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

6 years agoAMDGPU/SI: Emit global variable sizes when targeting HSA
Tom Stellard [Fri, 8 Jan 2016 14:50:28 +0000 (14:50 +0000)]
AMDGPU/SI: Emit global variable sizes when targeting HSA

Reviewers: arsenm

Subscribers: arsenm, llvm-commits

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

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

6 years agoAMDGPU: Emit functions sizes
Tom Stellard [Fri, 8 Jan 2016 14:50:23 +0000 (14:50 +0000)]
AMDGPU: Emit functions sizes

Reviewers: arsenm

Subscribers: arsenm, llvm-commits

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

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

6 years ago[ThinLTO] Delay metadata materializtion in function importer
Teresa Johnson [Fri, 8 Jan 2016 14:17:41 +0000 (14:17 +0000)]
[ThinLTO] Delay metadata materializtion in function importer

The function importer was still materializing metadata when modules were
loaded for function importing. We only want to materialize it when we
are going to invoke the metadata linking postpass. Materializing it
before function importing is not only unnecessary, but also causes
metadata referenced by imported functions to be mapped in early, and
then not connected to the rest of the module level metadata when it is
ultimately linked in.

Augmented the test case to specifically check for the metadata being
properly connected, which it wasn't before this fix.

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

6 years agoPrevent renaming of CR fields in AADB when a CR restore is present
Nemanja Ivanovic [Fri, 8 Jan 2016 13:09:54 +0000 (13:09 +0000)]
Prevent renaming of CR fields in AADB when a CR restore is present

This patch corresponds to review:
http://reviews.llvm.org/D15930

Moves to and from CR fields depend on shifts/masks that depend on the
target/source CR field. Thus, post-ra anti-dep breaking must not later
change that CR register assignment.

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

6 years agoInstCombineCompares.cpp: Fix a warning. [-Wbraced-scalar-init]
NAKAMURA Takumi [Fri, 8 Jan 2016 12:50:03 +0000 (12:50 +0000)]
InstCombineCompares.cpp: Fix a warning. [-Wbraced-scalar-init]

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

6 years agoRe-commit r257064, this time with a fixed assert
Silviu Baranga [Fri, 8 Jan 2016 11:11:04 +0000 (11:11 +0000)]
Re-commit r257064, this time with a fixed assert

In setInsertionPoint if the value is not a PHI, Instruction or
Argument it should be a Constant, not a ConstantExpr.

Original commit message:

[InstCombine] Look through PHIs, GEPs, IntToPtrs and PtrToInts to expose more constants when comparing GEPs

Summary:
When comparing two GEP instructions which have the same base pointer
and one of them has a constant index, it is possible to only compare
indices, transforming it to a compare with a constant. This removes
one use for the GEP instruction with the constant index, can reduce
register pressure and can sometimes lead to removing the comparisson
entirely.

InstCombine was already doing this when comparing two GEPs if the base
pointers were the same. However, in the case where we have complex
pointer arithmetic (GEPs applied to GEPs, PHIs of GEPs, conversions to
or from integers, etc) the value of the original base pointer will be
hidden to the optimizer and this transformation will be disabled.

This change detects when the two sides of the comparison can be
expressed as GEPs with the same base pointer, even if they don't
appear as such in the IR. The transformation will convert all the
pointer arithmetic to arithmetic done on indices and all the relevant
uses of GEPs to GEPs with a common base pointer. The GEP comparison
will be converted to a comparison done on indices.

Reviewers: majnemer, jmolloy

Subscribers: hfinkel, jevinskie, jmolloy, aadg, llvm-commits

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

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

6 years ago[attrs] Split the late-revisit pattern for deducing norecurse in
Chandler Carruth [Fri, 8 Jan 2016 10:55:52 +0000 (10:55 +0000)]
[attrs] Split the late-revisit pattern for deducing norecurse in
a top-down manner into a true top-down or RPO pass over the call graph.

There are specific patterns of function attributes, notably the
norecurse attribute, which are most effectively propagated top-down
because all they us caller information.

Walk in RPO over the call graph SCCs takes the form of a module pass run
immediately after the CGSCC pass managers postorder walk of the SCCs,
trying again to deduce norerucrse for each singular SCC in the call
graph.

This removes a very legacy pass manager specific trick of using a lazy
revisit list traversed during finalization of the CGSCC pass. There is
no analogous finalization step in the new pass manager, and a lazy
revisit list is just trying to produce an RPO iteration of the call
graph. We can do that more directly if more expensively. It seems
unlikely that this will be the expensive part of any compilation though
as we never examine the function bodies here. Even in an LTO run over
a very large module, this should be a reasonable fast set of operations
over a reasonably small working set -- the function call graph itself.

In the future, if this really is a compile time performance issue, we
can look at building support for both post order and RPO traversals
directly into a pass manager that builds and maintains the PO list of
SCCs.

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

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

6 years ago[LCG] Re-order the lazy node iterator below the node type to make some
Chandler Carruth [Fri, 8 Jan 2016 10:50:11 +0000 (10:50 +0000)]
[LCG] Re-order the lazy node iterator below the node type to make some
subsequent work I'm doing not have its delta obscured by boring code
motion. NFC.

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

6 years ago[WinEH] Update WinEHFuncInfo if StackColoring merges allocas
David Majnemer [Fri, 8 Jan 2016 08:03:55 +0000 (08:03 +0000)]
[WinEH] Update WinEHFuncInfo if StackColoring merges allocas

Windows EH keeping track of which frame index corresponds to a catchpad
in order to inform the runtime where the catch parameter should be
initialized.  LLVM's optimizations are able to prove that the memory
used by the catch parameter can be reused with another memory
optimization, changing it's frame index.

We need to keep WinEHFuncInfo up to date with respect to this or we will
miscompile/assert.

This fixes PR26069.

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

6 years agoInstrProfTest.cpp: Fix a warning. [-Wsign-compare]
NAKAMURA Takumi [Fri, 8 Jan 2016 07:58:20 +0000 (07:58 +0000)]
InstrProfTest.cpp: Fix a warning. [-Wsign-compare]

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

6 years ago[TableGen] Use range-based for loops. Also fix one loop to not use some index name...
Craig Topper [Fri, 8 Jan 2016 07:06:32 +0000 (07:06 +0000)]
[TableGen] Use range-based for loops. Also fix one loop to not use some index name as an outer loop. NFC

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

6 years ago[TableGen] Combine variable declaration and initialization. Move a string into a...
Craig Topper [Fri, 8 Jan 2016 07:06:29 +0000 (07:06 +0000)]
[TableGen] Combine variable declaration and initialization. Move a string into a vector instead of copying. NFC

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

6 years agoAdd value site truncation unit test
Xinliang David Li [Fri, 8 Jan 2016 06:54:27 +0000 (06:54 +0000)]
Add value site truncation unit test

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

6 years ago[AVR] Added AVRSelectionDAGInfo header file
Dylan McKay [Fri, 8 Jan 2016 06:32:27 +0000 (06:32 +0000)]
[AVR] Added AVRSelectionDAGInfo header file

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

6 years ago[AVX-512] Remove superfluous spaces from some asm strings.
Craig Topper [Fri, 8 Jan 2016 06:09:20 +0000 (06:09 +0000)]
[AVX-512] Remove superfluous spaces from some asm strings.

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

6 years ago[X86] Don't print the aliased version of CVTSD2SI64rm. This appears to be a mistake...
Craig Topper [Fri, 8 Jan 2016 06:09:18 +0000 (06:09 +0000)]
[X86] Don't print the aliased version of CVTSD2SI64rm. This appears to be a mistake I made years ago.

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

6 years ago[X86] Use \t instead of space after mnemonics in a bunch InstAliases for consistency.
Craig Topper [Fri, 8 Jan 2016 06:09:13 +0000 (06:09 +0000)]
[X86] Use \t instead of space after mnemonics in a bunch InstAliases for consistency.

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

6 years ago[PGO] Ensure vp data in indexed profile always sorted
Xinliang David Li [Fri, 8 Jan 2016 05:45:21 +0000 (05:45 +0000)]
[PGO] Ensure vp data in indexed profile always sorted

Done in  InstrProfWriter to eliminate the need for client
code to do the sorting. The operation is done once and reused
many times so it is more efficient. Update unit test to remove
sorting. Also update expected output of affected tests.

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

6 years agoRemove extra whitespace. NFC.
Junmo Park [Fri, 8 Jan 2016 04:20:32 +0000 (04:20 +0000)]
Remove extra whitespace. NFC.

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

6 years ago[PGO] Fix a bug in InstProfWriter addRecord
Xinliang David Li [Fri, 8 Jan 2016 03:49:59 +0000 (03:49 +0000)]
[PGO] Fix a bug in InstProfWriter addRecord

For a new record with weight != 1, only edge profiling
counters are scaled, VP data is not properly scaled.

This patch refactors the code and fixes the problem.
Also added sort by count interface (for follow up patch).

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

6 years agoRemove static global GCNames from Function.cpp and move it to the Context
Mehdi Amini [Fri, 8 Jan 2016 02:28:20 +0000 (02:28 +0000)]
Remove static global GCNames from Function.cpp and move it to the Context

This remove the need for locking when deleting a function.

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

From: Mehdi Amini <mehdi.amini@apple.com>

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

6 years agoAdd call sequence start and end for __tls_get_addr
Kyle Butt [Fri, 8 Jan 2016 02:06:19 +0000 (02:06 +0000)]
Add call sequence start and end for __tls_get_addr

This is a fix for bug http://llvm.org/bugs/show_bug.cgi?id=25839.

For a PIC TLS variable access in a function, prologue (mflr followed by std and
stdu) gets scheduled after a tls_get_addr call. tls_get_addr messed up LR but
no one saves/restores it.

Also added a test for save/restore clobbered registers during calling __tls_get_addr.

Patch by Tim Shen

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

6 years ago[Vectorization] Actually return from error case in isStridedPtr
Kyle Butt [Fri, 8 Jan 2016 01:55:13 +0000 (01:55 +0000)]
[Vectorization] Actually return from error case in isStridedPtr

The early return seems to be missed. This causes a radical and wrong loop
optimization on powerpc. It isn't reproducible on x86_64, because
"UseInterleaved" is false.

Patch by Tim Shen.

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

6 years ago[InstCombine] insert a new shuffle in a safe place (PR25999)
Sanjay Patel [Fri, 8 Jan 2016 01:39:16 +0000 (01:39 +0000)]
[InstCombine] insert a new shuffle in a safe place (PR25999)

Limit this transform to a basic block and guard against PHIs.
Hopefully, this fixes the remaining failures in PR25999:
https://llvm.org/bugs/show_bug.cgi?id=25999

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

6 years ago[WebAssembly] Minor code cleanups. NFC.
Dan Gohman [Fri, 8 Jan 2016 01:18:00 +0000 (01:18 +0000)]
[WebAssembly] Minor code cleanups. NFC.

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

6 years agoIntEqClasses: Let join() return the new leader
Matthias Braun [Fri, 8 Jan 2016 01:16:39 +0000 (01:16 +0000)]
IntEqClasses: Let join() return the new leader

The new leader is known anyway so we can return it for some micro
optimization in code where it is easy to pass along the result to the
next join().

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

6 years agoLiveInterval: A LiveRange is enough for ConnectedVNInfoEqClasses::Classify()
Matthias Braun [Fri, 8 Jan 2016 01:16:35 +0000 (01:16 +0000)]
LiveInterval: A LiveRange is enough for ConnectedVNInfoEqClasses::Classify()

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

6 years ago[WebAssembly] Minor code cleanups. NFC.
Dan Gohman [Fri, 8 Jan 2016 01:06:00 +0000 (01:06 +0000)]
[WebAssembly] Minor code cleanups. NFC.

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

6 years ago[WebAssembly] Remove an unused def : Pat.
Dan Gohman [Fri, 8 Jan 2016 00:50:33 +0000 (00:50 +0000)]
[WebAssembly] Remove an unused def : Pat.

WebAssemblyISelLowering.cpp does not wrap jump table nodes inside of
WebAssemblywrapper nodes, so this pattern is not currently used.

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

6 years ago[WebAssembly] Remove unused arguments, unused functions. NFC.
Dan Gohman [Fri, 8 Jan 2016 00:43:54 +0000 (00:43 +0000)]
[WebAssembly] Remove unused arguments, unused functions. NFC.

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

6 years ago[PGO] : Removing trailing space/define new macro/NFC
Xinliang David Li [Fri, 8 Jan 2016 00:38:53 +0000 (00:38 +0000)]
[PGO] : Removing trailing space/define new macro/NFC

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

6 years agoAdd some testing for thumb1 and thumb2 inline asm immediate constraints
Eric Christopher [Fri, 8 Jan 2016 00:34:44 +0000 (00:34 +0000)]
Add some testing for thumb1 and thumb2 inline asm immediate constraints
and fix a couple of bugs on inspection.

Also fixes PR26061.

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

6 years ago[llvm-symbolizer] Print out non-address lines verbatim.
Mike Aizatsky [Thu, 7 Jan 2016 23:57:41 +0000 (23:57 +0000)]
[llvm-symbolizer] Print out non-address lines verbatim.

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

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

6 years ago[LiveDebugValues] Replace several lines of code with operator[].
Alexey Samsonov [Thu, 7 Jan 2016 23:38:45 +0000 (23:38 +0000)]
[LiveDebugValues] Replace several lines of code with operator[].

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

6 years agoInstructions to be redone only if from the same BB
Aditya Nandakumar [Thu, 7 Jan 2016 23:22:55 +0000 (23:22 +0000)]
Instructions to be redone only if from the same BB

While adding instructions(possible roots) to be redone, make sure they
are from the same basic block.

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

6 years agoWebAssembly: use .skip instead of .zero directive
JF Bastien [Thu, 7 Jan 2016 23:18:29 +0000 (23:18 +0000)]
WebAssembly: use .skip instead of .zero directive

.zero is confusing when used with two arguments. Documentation:

  This directive emits SIZE 0-valued bytes.  SIZE must be an absolute
  expression.  This directive is actually an alias for the '.skip'
  directive so in can take an optional second argument of the value to
  store in the bytes instead of zero.  Using '.zero' in this way would be
  confusing however.

Ref: https://sourceware.org/bugzilla/show_bug.cgi?id=18353

Hexagon and Sparc do the same, and it's all the same to WebAssembly so
let's pick the less confusing of the two.

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

6 years ago[PGO] Minor refactoring /NFC
Xinliang David Li [Thu, 7 Jan 2016 22:46:29 +0000 (22:46 +0000)]
[PGO] Minor refactoring /NFC

Move common defs into common header files.

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

6 years agoTemporarily revert r257105 "[Verifier] Check that debug values have proper size"
Keno Fischer [Thu, 7 Jan 2016 22:39:11 +0000 (22:39 +0000)]
Temporarily revert r257105 "[Verifier] Check that debug values have proper size"

Looks like there's a case where clang generates debug info that triggers
the new verifier check. Reverting while investigating.

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

6 years ago[Verifier] Check that debug values have proper size
Keno Fischer [Thu, 7 Jan 2016 22:18:37 +0000 (22:18 +0000)]
[Verifier] Check that debug values have proper size

Summary:
Teach the Verifier to make sure that the storage size given to llvm.dbg.declare
or the value size given to llvm.dbg.value agree with what is declared in
DebugInfo. This is implicitly assumed in a number of passes (e.g. in SROA).
Additionally this catches a number of common mistakes, such as passing a
pointer when a value was intended or vice versa.

One complication comes from stack coloring which modifies the original IR when
it merges allocas in order to make sure that if AA falls back to the IR it gets
the correct result. However, given this new invariant, indiscriminately
replacing one alloca by a different (differently sized one) is no longer valid.
Fix this by just undefing out any use of the alloca in a dbg.declare in this
case.

Additionally, I had to fix a number of test cases. Of particular note:
- I regenerated dbg-changes-codegen-branch-folding.ll from the given source as
  it was affected by the bug fixed in r256077
- two-cus-from-same-file.ll was changed to avoid having a variable-typed debug
  variable as that would depend on the target, even though this test is
  supposed to be generic
- I had to manually declared size/align for reference type. See also the
  discussion for D14275/r253186.
- fpstack-debuginstr-kill.ll required changing `double` to `long double`
- most others were just a question of adding OP_deref

Reviewers: aprantl
Differential Revision: http://reviews.llvm.org/D14276

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

6 years agoTurn off lldb debug tuning by default for FreeBSD
Dimitry Andric [Thu, 7 Jan 2016 22:09:12 +0000 (22:09 +0000)]
Turn off lldb debug tuning by default for FreeBSD

Summary:
In rL242338, debugger tuning was introduced, and the tuning for FreeBSD
was set to lldb by default.  However, for the foreseeable future we
still need to default to gdb tuning, since lldb is not ready for all of
FreeBSD's architectures, and some system tools (like objcopy, etc) have
not yet been adapted to cope with the lldb tuned format, which has
.apple sections.

Therefore, let FreeBSD use gdb by default for now.

Reviewers: emaste, probinson

Subscribers: llvm-commits, emaste

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

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

6 years ago[SCCP] Don't violate the lattice invariants
David Majnemer [Thu, 7 Jan 2016 21:36:16 +0000 (21:36 +0000)]
[SCCP] Don't violate the lattice invariants

We marked values which are 'undef' as constant instead of undefined
which violates SCCP's invariants.  If we can figure out that a
computation results in 'undef', leave it in the undefined state.

This fixes PR16052.

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

6 years agoWebAssembly: update expected failures, more assert got resolved.
JF Bastien [Thu, 7 Jan 2016 21:00:37 +0000 (21:00 +0000)]
WebAssembly: update expected failures, more assert got resolved.

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

6 years agoFix crash when printing instructions that have a metadata attached but no parent.
Mehdi Amini [Thu, 7 Jan 2016 20:14:30 +0000 (20:14 +0000)]
Fix crash when printing instructions that have a metadata attached but no parent.

Fix PR24852 (crash with -debug -instcombine)

Patch by Than McIntosh <thanm@google.com>

Summary:
Add guards to the asm writer to prevent crashing
when dumping an instruction that has no basic
block.

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

From: Than McIntosh <thanm@google.com>

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

6 years agoWebAssembly: update expected failures, assert got resolved by r257084.
JF Bastien [Thu, 7 Jan 2016 20:07:21 +0000 (20:07 +0000)]
WebAssembly: update expected failures, assert got resolved by r257084.

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

6 years ago[PGO] Simplify coverage mapping lowering
Xinliang David Li [Thu, 7 Jan 2016 20:05:49 +0000 (20:05 +0000)]
[PGO] Simplify coverage mapping lowering

Coverage mapping data may reference names of functions
that are skipped by FE (e.g, unused inline functions). Since
those functions are skipped, normal instr-prof function lowering
pass won't put those names in the right section, so special
handling is needed to walk through coverage mapping structure
and recollect the references.

With this patch, only names that are skipped are processed. This
simplifies the lowering code and it no longer needs to make
assumptions coverage mapping data layout. It should also be
more efficient.

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

6 years agoRemove junk accidentally commited with r257087
David Majnemer [Thu, 7 Jan 2016 19:30:13 +0000 (19:30 +0000)]
Remove junk accidentally commited with r257087

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

6 years agoAdd test for r256912
David Majnemer [Thu, 7 Jan 2016 19:27:16 +0000 (19:27 +0000)]
Add test for r256912

I forgot to add this with the rest of r256912.

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

6 years ago[SCCP] Can't go from overdefined to constant
David Majnemer [Thu, 7 Jan 2016 19:25:39 +0000 (19:25 +0000)]
[SCCP] Can't go from overdefined to constant

The fix for PR23999 made us mark loads of null as producing the constant
undef which upsets the lattice.  Instead, keep the load as "undefined".
This fixes PR26044.

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

6 years ago[DominatorTree] Remove unnecessary map population. NFC.
Michael Liao [Thu, 7 Jan 2016 19:21:29 +0000 (19:21 +0000)]
[DominatorTree] Remove unnecessary map population. NFC.

- The reason of population these maps seems not valid any more.

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

6 years ago[WebAssembly] Support combining GEP and FrameIndex offsets in memory operand offset...
Derek Schuff [Thu, 7 Jan 2016 18:55:52 +0000 (18:55 +0000)]
[WebAssembly] Support combining GEP and FrameIndex offsets in memory operand offset field

Previously we only supported putting the FI into memory operand offset
fields if there was nothing there already. Now combine them.

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

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

6 years ago[WebAssembly] Use the default private label prefixes.
Dan Gohman [Thu, 7 Jan 2016 18:49:53 +0000 (18:49 +0000)]
[WebAssembly] Use the default private label prefixes.

The MC assembler doesn't like using the empty string as a private label
prefix because then it treats all labels as private. This commit reverts
back to the default prefix, which is .L, which is common in ELF targets
and consistent with the LLVM name mangler.

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

6 years agoAMDGPU/SI: Fold operands with sub-registers
Nicolai Haehnle [Thu, 7 Jan 2016 17:10:29 +0000 (17:10 +0000)]
AMDGPU/SI: Fold operands with sub-registers

Summary:
Multi-dword constant loads generated unnecessary moves from SGPRs into VGPRs,
increasing the code size and VGPR pressure. These moves are now folded away.

Note that this lack of operand folding was not a problem for VMEM loads,
because COPY nodes from VReg_Nnn to VGPR32 are eliminated by the register
coalescer.

Some tests are updated, note that the fsub.ll test explicitly checks that
the move is elided.

With the IR generated by current Mesa, the changes are obviously relatively
minor:

7063 shaders in 3531 tests
Totals:
SGPRS: 351872 -> 352560 (0.20 %)
VGPRS: 199984 -> 200732 (0.37 %)
Code Size: 9876968 -> 9881112 (0.04 %) bytes
LDS: 91 -> 91 (0.00 %) blocks
Scratch: 1779712 -> 1767424 (-0.69 %) bytes per wave
Wait states: 295164 -> 295337 (0.06 %)

Totals from affected shaders:
SGPRS: 65784 -> 66472 (1.05 %)
VGPRS: 38064 -> 38812 (1.97 %)
Code Size: 1993828 -> 1997972 (0.21 %) bytes
LDS: 42 -> 42 (0.00 %) blocks
Scratch: 795648 -> 783360 (-1.54 %) bytes per wave
Wait states: 54026 -> 54199 (0.32 %)

Reviewers: tstellarAMD, arsenm, mareko

Subscribers: arsenm, llvm-commits

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

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

6 years agoAMDGPU/SI: xnack_mask is always reserved on VI
Nicolai Haehnle [Thu, 7 Jan 2016 17:10:20 +0000 (17:10 +0000)]
AMDGPU/SI: xnack_mask is always reserved on VI

Summary:
Somehow, I first interpreted the docs as saying space for xnack_mask is only
reserved when XNACK is enabled via SH_MEM_CONFIG. I felt uneasy about this and
went back to actually test what is happening, and it turns out that xnack_mask
is always reserved at least on Tonga and Carrizo, in the sense that flat_scr
is always fixed below the SGPRs that are used to implement xnack_mask, whether
or not they are actually used.

I confirmed this by writing a shader using inline assembly to tease out the
aliasing between flat_scratch and regular SGPRs. For example, on Tonga, where
we fix the number of SGPRs to 80, s[74:75] aliases flat_scratch (so
xnack_mask is s[76:77] and vcc is s[78:79]).

This patch changes both the calculation of the total number of SGPRs and the
various register reservations to account for this.

It ought to be possible to use the gap left by xnack_mask when the feature
isn't used, but this patch doesn't try to do that. (Note that the same applies
to vcc.)

Note that previously, even before my earlier change in r256794, the SGPRs that
alias to xnack_mask could end up being used as well when flat_scr was unused
and the total number of SGPRs happened to fall on the right alignment
(e.g. highest regular SGPR being used s29 and VCC used would lead to number
of SGPRs being 32, where s28 and s29 alias with xnack_mask). So if there
were some conflict due to such aliasing, we should have noticed that already.

Reviewers: arsenm, tstellarAMD

Subscribers: arsenm, llvm-commits

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

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

6 years ago[avx512] Fix test avx512bw-intrinsics.ll
Michael Zuckerman [Thu, 7 Jan 2016 16:25:42 +0000 (16:25 +0000)]
[avx512] Fix test avx512bw-intrinsics.ll
Change the CHECK lablel into AVX512BW
And fix declare lable of llvm.x86.avx512.mask.psrav32_hi

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

6 years ago[AVX512] add PSLLW and PSLLV Intrinsic
Michael Zuckerman [Thu, 7 Jan 2016 16:02:51 +0000 (16:02 +0000)]
[AVX512] add PSLLW and PSLLV Intrinsic

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

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

6 years agoRevert r257064. It caused failures in some sanitizer tests.
Silviu Baranga [Thu, 7 Jan 2016 15:46:43 +0000 (15:46 +0000)]
Revert r257064. It caused failures in some sanitizer tests.

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

6 years agoFix build after r257064: we should be returning false, not nullptr
Silviu Baranga [Thu, 7 Jan 2016 15:09:22 +0000 (15:09 +0000)]
Fix build after r257064: we should be returning false, not nullptr

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

6 years agoRevert r257055, it caused PR26064.
Nico Weber [Thu, 7 Jan 2016 15:01:46 +0000 (15:01 +0000)]
Revert r257055, it caused PR26064.

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

6 years ago[InstCombine] Look through PHIs, GEPs, IntToPtrs and PtrToInts to expose more constan...
Silviu Baranga [Thu, 7 Jan 2016 14:56:08 +0000 (14:56 +0000)]
[InstCombine] Look through PHIs, GEPs, IntToPtrs and PtrToInts to expose more constants when comparing GEPs

Summary:
When comparing two GEP instructions which have the same base pointer
and one of them has a constant index, it is possible to only compare
indices, transforming it to a compare with a constant. This removes
one use for the GEP instruction with the constant index, can reduce
register pressure and can sometimes lead to removing the comparisson
entirely.

InstCombine was already doing this when comparing two GEPs if the
base pointers were the same. However, in the case where we have
complex pointer arithmetic (GEPs applied to GEPs, PHIs of GEPs,
conversions to or from integers, etc) the value of the original
base pointer will be hidden to the optimizer and this transformation
will be disabled.

This change detects when the two sides of the comparison can be
expressed as GEPs with the same base pointer, even if they don't
appear as such in the IR. The transformation will convert all the
pointer arithmetic to arithmetic done on indices and all the
relevant uses of GEPs to GEPs with a common base pointer. The
GEP comparison will be converted to a comparison done on indices.

Reviewers: majnemer, jmolloy

Subscribers: hfinkel, jevinskie, jmolloy, aadg, llvm-commits

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

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

6 years ago[AVX512] add PSRAV Intrinsic
Michael Zuckerman [Thu, 7 Jan 2016 14:42:20 +0000 (14:42 +0000)]
[AVX512] add PSRAV Intrinsic

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

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

6 years agoAdded support for macro emission in dwarf (supporting DWARF version 4).
Amjad Aboud [Thu, 7 Jan 2016 14:28:20 +0000 (14:28 +0000)]
Added support for macro emission in dwarf (supporting DWARF version 4).

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

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

6 years ago[GlobalsAA] Partially back out r248576
James Molloy [Thu, 7 Jan 2016 13:33:28 +0000 (13:33 +0000)]
[GlobalsAA] Partially back out r248576

See PR25822 for a more full summary, but we were conflating the concepts of "capture" and "escape". We were proving nocapture and using that proof to infer noescape, which is not true. Escaped-ness is a function-local property - as soon as a value is used in a call argument it escapes. Capturedness is a related but distinct property. It implies a *temporally limited* escape. Consider:

  static int a;
  int b;
  int g(int * nocapture arg);
  int f() {
    a = 2;  // Even though a escapes to g, it is not captured so can be treated as non-escaping here.
    g(&a);  // But here it must be treated as escaping.
    g(&b);  // Now that g(&a) has returned we know it was not captured so we can treat it as non-escaping again.
  }

The original commit did not sufficiently understand this nuance and so caused PR25822 and PR26046.

r248576 included both a performance improvement (which has been backed out) and a related conformance fix (which has been kept along with its testcase).

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

6 years ago[AVX512] add PSHUFHW and PSHUFLW Intrinsic
Michael Zuckerman [Thu, 7 Jan 2016 12:35:43 +0000 (12:35 +0000)]
[AVX512] add PSHUFHW and PSHUFLW Intrinsic

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

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

6 years ago[X86][AVX] Match broadcast loads through a bitcast
Simon Pilgrim [Thu, 7 Jan 2016 11:34:27 +0000 (11:34 +0000)]
[X86][AVX] Match broadcast loads through a bitcast

AVX1 v8i32/v4i64 shuffles are bitcasted to v8f32/v4f64, this patch peeks through bitcasts to check for a load node to allow broadcasts to occur.

Follow up to D15310

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