oota-llvm.git
6 years ago[JumpThreading] Don't forget to report that the IR changed
David Majnemer [Sun, 10 Jan 2016 07:13:04 +0000 (07:13 +0000)]
[JumpThreading] Don't forget to report that the IR changed

JumpThreading's runOnFunction is supposed to return true if it made any
changes.  JumpThreading has a call to removeUnreachableBlocks which may
result in changes to the IR but runOnFunction didn't appropriate account
for this possibility, leading to badness.

While we are here, make sure to call LazyValueInfo::eraseBlock in
removeUnreachableBlocks;  JumpThreading preserves LVI.

This fixes PR26096.

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

6 years agoFix a control flow problem in commit rL257277.
Chen Li [Sun, 10 Jan 2016 06:13:32 +0000 (06:13 +0000)]
Fix a control flow problem in commit rL257277.

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

6 years ago[SimplifyCFG] Extend SimplifyResume to handle phi of trivial landing pad.
Chen Li [Sun, 10 Jan 2016 05:48:01 +0000 (05:48 +0000)]
[SimplifyCFG] Extend SimplifyResume to handle phi of trivial landing pad.

Summary:
This is a fix of D13718. D13718 was committed but then reverted because of the following bug:
https://llvm.org/bugs/show_bug.cgi?id=25299

This patch fixes the issue shown in the bug.

Reviewers: majnemer, reames

Subscribers: jevinskie, llvm-commits

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

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

6 years ago[LangRef] Move catchpad to "Other Operators" (NFC)
Joseph Tremoulet [Sun, 10 Jan 2016 04:46:10 +0000 (04:46 +0000)]
[LangRef] Move catchpad to "Other Operators" (NFC)

It is no longer a terminator, so should no longer be grouped with them.

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

6 years ago[WinEH] Fix catchpad pred verification
Joseph Tremoulet [Sun, 10 Jan 2016 04:32:03 +0000 (04:32 +0000)]
[WinEH] Fix catchpad pred verification

Summary:
The code was simply ensuring that the catchpad's pred is its catchswitch,
which was letting cases slip through where the flow edge was the unwind
edge of the catchswitch rather than one of its catch clauses.

Reviewers: andrew.w.kaylor, rnk, majnemer

Subscribers: llvm-commits

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

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

6 years ago[WinEH] Disallow cyclic unwinds
Joseph Tremoulet [Sun, 10 Jan 2016 04:31:05 +0000 (04:31 +0000)]
[WinEH] Disallow cyclic unwinds

Summary:
Funclet-based EH personalities/tables likely can't handle these, and they
can't be generated at source, so make them officially illegal in IR as
well.

Reviewers: andrew.w.kaylor, rnk, majnemer

Subscribers: llvm-commits

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

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

6 years ago[WinEH] Verify consistent funclet unwind exits
Joseph Tremoulet [Sun, 10 Jan 2016 04:30:02 +0000 (04:30 +0000)]
[WinEH] Verify consistent funclet unwind exits

Summary:
A funclet EH pad may be exited by an unwind edge, which may be a
cleanupret exiting its cleanuppad, an invoke exiting a funclet, or an
unwind out of a nested funclet transitively exiting its parent.  Funclet
EH personalities require all such exceptional exits from a given funclet to
have the same unwind destination, and EH preparation / state numbering /
table generation implicitly depends on this.  Formalize it as a rule of
the IR in the LangRef and verifier.

Reviewers: rnk, majnemer, andrew.w.kaylor

Subscribers: llvm-commits

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

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

6 years ago[WinEH] Verify unwind edges against EH pad tree
Joseph Tremoulet [Sun, 10 Jan 2016 04:28:38 +0000 (04:28 +0000)]
[WinEH] Verify unwind edges against EH pad tree

Summary:
Funclet EH personalities require a tree-like nesting among funclets
(enforced by the ParentPad linkage in the IR), and also require that
unwind edges conform to certain rules with respect to the tree:
 - An unwind edge may exit 0 or more ancestor pads
 - An unwind edge must enter exactly one EH pad, which must be distinct
   from any exited pads
 - A cleanupret's edge must exit its cleanuppad

Describe these rules in the LangRef, and enforce them in the verifier.

Reviewers: rnk, majnemer, andrew.w.kaylor

Subscribers: llvm-commits

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

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

6 years agoDon't use random class variables across functions
Daniel Berlin [Sun, 10 Jan 2016 03:25:42 +0000 (03:25 +0000)]
Don't use random class variables across functions

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

6 years agoRevert "[BranchFolding] Set correct mem refs"
Michael Zolotukhin [Sat, 9 Jan 2016 23:53:16 +0000 (23:53 +0000)]
Revert "[BranchFolding] Set correct mem refs"

This reverts commit 1ff11017d2669b933b29fcbb6451cfcda34ad693.

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

6 years ago[Orc] Fix MSVC build errors due to r257265 by adding explicit move construction
Lang Hames [Sat, 9 Jan 2016 22:05:08 +0000 (22:05 +0000)]
[Orc] Fix MSVC build errors due to r257265 by adding explicit move construction
and assignment to LogicalDylibResources.

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

6 years agoRevert "Teach the CMake build system to run lit's test suite. These can be run"
Dan Liew [Sat, 9 Jan 2016 21:42:57 +0000 (21:42 +0000)]
Revert "Teach the CMake build system to run lit's test suite. These can be run"

This reverts r257221.

This caused several build bot failures

* It looks like some of the tests don't work correctly under Windows
* It looks like the lit per test timeout tests fail

So I'm reverting for now. Once the above failures are fixed running
lit's tests can be enabled again.

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

6 years ago[X86][AVX] Match broadcast loads through a bitcast
Simon Pilgrim [Sat, 9 Jan 2016 20:59:39 +0000 (20:59 +0000)]
[X86][AVX] Match broadcast loads through a bitcast

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

This is a re-commit of r257055 after r257264 fixed 32-bit broadcast loads of i64 scalars.

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

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