oota-llvm.git
8 years ago[WinEH] Relax assertion in the presence of stack realignment
Reid Kleckner [Thu, 8 Oct 2015 18:41:52 +0000 (18:41 +0000)]
[WinEH] Relax assertion in the presence of stack realignment

The code is correct as is, but we should test it.

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

8 years ago[PowerPC] Add R_PPC64_GLOB_DAT and R_PPC64_RELATIVE to PowerPC64.def
Hal Finkel [Thu, 8 Oct 2015 18:30:27 +0000 (18:30 +0000)]
[PowerPC] Add R_PPC64_GLOB_DAT and R_PPC64_RELATIVE to PowerPC64.def

These are not used by LLVM proper, but will be used by upcoming commits to lld
(and will receive test coverage there).

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

8 years ago[SCEV] Remove comment repeated in cpp file; NFC
Sanjoy Das [Thu, 8 Oct 2015 18:28:42 +0000 (18:28 +0000)]
[SCEV] Remove comment repeated in cpp file; NFC

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

8 years ago[SCEV] Pick backedge values for phi nodes correctly
Sanjoy Das [Thu, 8 Oct 2015 18:28:36 +0000 (18:28 +0000)]
[SCEV] Pick backedge values for phi nodes correctly

Summary:
`getConstantEvolutionLoopExitValue` and `ComputeExitCountExhaustively`
assumed all phi nodes in the loop header have the same order of incoming
values.  This is not correct, and this commit changes
`getConstantEvolutionLoopExitValue` and `ComputeExitCountExhaustively`
to lookup the backedge value of a phi node using the loop's latch block.

Unfortunately, there is still some code duplication
`getConstantEvolutionLoopExitValue` and `ComputeExitCountExhaustively`.
At some point in the future we should extract out a helper class /
method that can evolve constant evolution phi nodes across iterations.

Fixes 25060.  Thanks to Mattias Eriksson for the spot-on analysis!

Depends on D13457.

Reviewers: atrick, hfinkel

Subscribers: materi, llvm-commits

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

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

8 years agoHandle Archive::getNumberOfSymbols being called in an archive with no symbols.
Rafael Espindola [Thu, 8 Oct 2015 18:06:20 +0000 (18:06 +0000)]
Handle Archive::getNumberOfSymbols being called in an archive with no symbols.

No change in llvm, but will be tested from lld.

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

8 years ago[SystemZ] Fix another assertion failure in tryBuildVectorShuffle
Ulrich Weigand [Thu, 8 Oct 2015 17:46:59 +0000 (17:46 +0000)]
[SystemZ] Fix another assertion failure in tryBuildVectorShuffle

This fixes yet another scenario where tryBuildVectorShuffle would
attempt to create a BUILD_VECTOR node with an invalid combination
of types.  This can happen if the incoming BUILD_VECTOR has elements
of a type different from the vector element type, which is allowed
in certain cases as long as they are all the same type.

When one of these elements is used in the residual vector, and
UNDEF elements are added to fill up the residual vector, those
UNDEFs then have to use the type of the original element, not
the vector element type, or else the resulting BUILD_VECTOR
will have an invalid type combination.

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

8 years agoMake the Kaleidoscope Orc examples -Wdeprecated clean by avoiding copying some AST...
David Blaikie [Thu, 8 Oct 2015 17:22:12 +0000 (17:22 +0000)]
Make the Kaleidoscope Orc examples -Wdeprecated clean by avoiding copying some AST nodes

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

8 years ago[InstCombine] transform masking off of an FP sign bit into a fabs() intrinsic call...
Sanjay Patel [Thu, 8 Oct 2015 17:09:31 +0000 (17:09 +0000)]
[InstCombine] transform masking off of an FP sign bit into a fabs() intrinsic call (PR24886)

This is a partial fix for PR24886:
https://llvm.org/bugs/show_bug.cgi?id=24886

Without this IR transform, the backend (x86 at least) was producing inefficient code.

This patch is making 2 assumptions:

    1. The canonical form of a fabs() operation is, in fact, the LLVM fabs() intrinsic.
    2. The high bit of an FP value is always the sign bit; as noted in the bug report, this isn't specified by the LangRef.

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

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

8 years ago[ValueTracking] teach computeKnownBits that a fabs() clears sign bits
Sanjay Patel [Thu, 8 Oct 2015 16:56:55 +0000 (16:56 +0000)]
[ValueTracking] teach computeKnownBits that a fabs() clears sign bits

This was requested in D13076: if we're going to canonicalize to fabs(), ValueTracking
should know that fabs() clears sign bits.

In this patch (as in D13076), we're not handling vectors yet even though computeKnownBits'
fabs() case itself should be vector-ready via the splat in this patch.
Fixing this will require follow-on patches to correct other logic that uses 'getScalarType'.

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

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

8 years agoFix a bug in llvm-objdump’s printing of Objective-C meta data
Kevin Enderby [Thu, 8 Oct 2015 16:56:35 +0000 (16:56 +0000)]
Fix a bug in llvm-objdump’s printing of Objective-C meta data
from malformed Mach-O files that caused a crash because of loops
in the class meta data.

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

8 years agoWindows: Fixed sys::findProgramByName to work with files containing dot in their...
George Rimar [Thu, 8 Oct 2015 16:03:19 +0000 (16:03 +0000)]
Windows: Fixed sys::findProgramByName to work with files containing dot in their name.

Problem was in SearchPathW function that does not attach an extension if file already has one.
That does not work for executables like ld.lld2 for example which require to have .exe extension but SearchPath thinks that its "lld2".
Solution was to add the extension manually.

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

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

8 years agoSupport for llvm-bcanalyzer dumping of record array strings.
Teresa Johnson [Thu, 8 Oct 2015 15:56:24 +0000 (15:56 +0000)]
Support for llvm-bcanalyzer dumping of record array strings.

Summary:
Adds support for automatically detecting and printing strings
represented by Array abbrev operands, analogous to the string dumping
performed for Blob abbrev operands.

Enhanced the ThinLTO combined index test to check for the appropriate
module and function strings.

Reviewers: dexonsmith, joker.eph, davidxl

Subscribers: llvm-commits

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

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

8 years ago[X86] Disable X86CallFrameOptimization on Darwin in presence of EH
Frederic Riss [Thu, 8 Oct 2015 15:45:08 +0000 (15:45 +0000)]
[X86] Disable X86CallFrameOptimization on Darwin in presence of EH

We emit 1 compact unwind encoding per function, and this can’t represent
the varying stack pointer that will be generated by X86CallFrameOptimization.
Disable the optimization on Darwin.

(It might be possible to split the function into multiple ranges
and emit 1 compact unwind info per range. The compact unwind emission
code isn’t ready for that and this kind of info certainly isn’t
tested/used anywhere. It might be worth exploring this path if we want
to get the space savings at some point though)

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

8 years agoFix combined function index abbrev (NFC)
Teresa Johnson [Thu, 8 Oct 2015 13:52:56 +0000 (13:52 +0000)]
Fix combined function index abbrev (NFC)

Removed an unused abbrev op in the VST_CODE_COMBINED_FNENTRY abbrev.

I noticed while writing/testing an array string dumper for
llvm-bcanalyze that the combined function's VST entry abbrevs contained
an old field that I am not using. Everything was working fine since the
bitcode writer and reader were in sync on how the record fields were
actually being set up and interpreted.

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

8 years agoAdd a helper for getting a section's content as an array.
Rafael Espindola [Thu, 8 Oct 2015 13:38:42 +0000 (13:38 +0000)]
Add a helper for getting a section's content as an array.

It will be used in lld shortly.

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

8 years agoFix UBSan test error from r248897 about left shift of unsigned value.
Teresa Johnson [Thu, 8 Oct 2015 13:14:59 +0000 (13:14 +0000)]
Fix UBSan test error from r248897 about left shift of unsigned value.

Fixed by masking off the upper bits that we are shifting off before
doing the left shift.

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

8 years agoAVX512: vpextrb/w/d/q and vpinsrb/w/d/q implementation.
Igor Breger [Thu, 8 Oct 2015 12:55:01 +0000 (12:55 +0000)]
AVX512: vpextrb/w/d/q and vpinsrb/w/d/q implementation.
This instructions doesn't have intrincis.
Added tests for lowering and encoding.

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

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

8 years agoCompute demanded bits for icmp instructions
James Molloy [Thu, 8 Oct 2015 12:40:06 +0000 (12:40 +0000)]
Compute demanded bits for icmp instructions

Instead of bailing out when we see an icmp, we can instead at least
say that if the upper bits of both operands are known zero, they are
not demanded. This doesn't help with signed comparisons, but it's at
least better than bailing out.

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

8 years agoTreat Mul just like Add and Subtract
James Molloy [Thu, 8 Oct 2015 12:39:59 +0000 (12:39 +0000)]
Treat Mul just like Add and Subtract

Like adds and subtracts, muls ripple only to the left so we can use
the same logic.

While we're here, add a print method to DemandedBits so it can be used
with -analyze, which we'll use in the testcase.

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

8 years agoMake demanded bits lazy
James Molloy [Thu, 8 Oct 2015 12:39:50 +0000 (12:39 +0000)]
Make demanded bits lazy

The algorithm itself is still eager, but it doesn't get run until a
query function is called. This greatly reduces the compile-time impact
of requiring DemandedBits when at runtime it is not often used.

NFCI.

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

8 years ago[X86] Fix wrong treatment of multi-lane blends in BUILD_VECTORtoBlendMask()
Michael Kuperstein [Thu, 8 Oct 2015 08:13:02 +0000 (08:13 +0000)]
[X86] Fix wrong treatment of multi-lane blends in BUILD_VECTORtoBlendMask()

This fixes two separate bugs:
1) The mask for the high lane was not set correctly. That fixes PR24532.
2) The transformation should bail out if it believes it involves more than
2 lanes, as it does not currently do anything sensible in this case.

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

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

8 years agoDo not assert on first non-prologue instruction being a CFI directive.
Michael Kuperstein [Thu, 8 Oct 2015 07:48:49 +0000 (07:48 +0000)]
Do not assert on first non-prologue instruction being a CFI directive.

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

8 years ago[SystemZ] SystemZElimCompare pass improved.
Jonas Paulsson [Thu, 8 Oct 2015 07:40:23 +0000 (07:40 +0000)]
[SystemZ] SystemZElimCompare pass improved.

Compare elimination extended to recognize load-and-test instructions used
for comparison and eliminate them the same way as with compare instructions.

Test case fp-cmp-05.ll updated to expect optimized results now also for z13.

The order of instruction shortening and compare elimination passes have been
changed so that opcodes do not have to be handled in both passes.

Reviewed by Ulrich Weigand.

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

8 years ago[SystemZ] Bugfix: check CC reg liveness in SystemZShortenInst.
Jonas Paulsson [Thu, 8 Oct 2015 07:40:19 +0000 (07:40 +0000)]
[SystemZ] Bugfix: check CC reg liveness in SystemZShortenInst.

The following instruction shortening transformations would introduce a
definition of the CC reg, so therefore liveness of CC reg must be checked:

WFADB -> ADBR
WFSDB -> SDBR

Also add the CC reg implicit def operand to the MI in case of change of opcode.

Reviewed by Ulrich Weigand.

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

8 years ago [SystemZ] Use load-and-test for fp compare with 0 if vector support is present.
Jonas Paulsson [Thu, 8 Oct 2015 07:40:16 +0000 (07:40 +0000)]
 [SystemZ] Use load-and-test for fp compare with 0 if vector support is present.

Since the LTxBRCompare instructions can't be used with vector registers, a
normal load-and-test instruction (with a modelled def operand) is used instead.

Reviewed by Ulrich Weigand.

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

8 years ago[SystemZ] More minor fixing in SystemZElimCompare.cpp
Jonas Paulsson [Thu, 8 Oct 2015 07:40:11 +0000 (07:40 +0000)]
[SystemZ] More minor fixing in SystemZElimCompare.cpp

Don't use subreg indices since they are not used after regalloc.

Reviewed by Ulrich Weigand.

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

8 years ago[SystemZ] Minor fixes in SystemZElimCompare.cpp
Jonas Paulsson [Thu, 8 Oct 2015 07:39:55 +0000 (07:39 +0000)]
[SystemZ] Minor fixes in SystemZElimCompare.cpp

Reviewed by Ulrich Weigand.

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

8 years agoUse range-based for loops. NFC.
Craig Topper [Thu, 8 Oct 2015 06:06:42 +0000 (06:06 +0000)]
Use range-based for loops. NFC.

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

8 years ago[SCEV] Check `Pred` first in isKnownPredicateViaSplitting
Sanjoy Das [Thu, 8 Oct 2015 03:46:00 +0000 (03:46 +0000)]
[SCEV] Check `Pred` first in isKnownPredicateViaSplitting

Comparing `Pred` with `ICmpInst::ICMP_ULT` is cheaper that memory access
-- do that check before loading / storing `ProvingSplitPredicate`.

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

8 years ago[SCEV] Use `auto *` instead of `auto`; NFCI
Sanjoy Das [Thu, 8 Oct 2015 03:45:58 +0000 (03:45 +0000)]
[SCEV] Use `auto *` instead of `auto`; NFCI

(As prescribed by the coding style document)

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

8 years agoRevert "Handle inline stacks in gcov-encoded sample profiles."
Diego Novillo [Thu, 8 Oct 2015 01:17:26 +0000 (01:17 +0000)]
Revert "Handle inline stacks in gcov-encoded sample profiles."

This reverts commit r249644.

The buildbots are failing the new test I added. Investigating.

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

8 years ago[libFuzzer] fix 32-bit build
Kostya Serebryany [Thu, 8 Oct 2015 00:59:25 +0000 (00:59 +0000)]
[libFuzzer] fix 32-bit build

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

8 years agoHandle inline stacks in gcov-encoded sample profiles.
Diego Novillo [Thu, 8 Oct 2015 00:39:11 +0000 (00:39 +0000)]
Handle inline stacks in gcov-encoded sample profiles.

This patch adds support for reading sample profiles with inline stacks.
Inline stacks in a profile are generated when the sampled binary has
samples in inlined functions.

For instance, if main() calls foo() and foo() calls bar(), and bar() is
inlined into foo() and foo() inlined into main(), the profile may look
something like:

main total:364084 head:0
  [ ... ]
  2.3: _Z3fool total:243786
    1: 60149
    1.2: 38568
    1.4: 46511
    1.7: _Z3bari total:98558
      1.1: 52672
      1.2: 45886

At line 2, discriminator 3, main() calls foo(). In turn, foo() calls
bar() at line 1, discriminator 7.

In the textual format, this stacking of inline calls is represented
with indentation.

With this change, LLVM can now read sample profile files generated by
the create_gcov tool from https://github.com/google/autofdo.

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

8 years agoCodeGen: print and verify after TargetPassConfig::insertPass by default
Justin Bogner [Thu, 8 Oct 2015 00:36:22 +0000 (00:36 +0000)]
CodeGen: print and verify after TargetPassConfig::insertPass by default

In r224059, we started verifying after addPass, but missed doing so on
insertPass. There isn't a good reason for the discrepancy, and
skipping the verifier in these cases causes bugs.

This also exposes a verifier error that was introduced in r249087, but
the verifier doesn't run until after the register coalescer, when the
issue happens to have been resolved. I've skipped the verifier after
SIFixSGPRLiveRangesID to avoid the failures for now and will follow up
with Matt for a proper fix.

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

8 years ago[WinEH] Add missing test case for llvm.eh.exceptioncode
Reid Kleckner [Wed, 7 Oct 2015 23:55:06 +0000 (23:55 +0000)]
[WinEH] Add missing test case for llvm.eh.exceptioncode

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

8 years ago[WinEH] Fix 32-bit funclet epilogues in the presence of dynamic allocas
Reid Kleckner [Wed, 7 Oct 2015 23:55:01 +0000 (23:55 +0000)]
[WinEH] Fix 32-bit funclet epilogues in the presence of dynamic allocas

In particular, passing non-trivially copyable objects by value on win32
uses a dynamic alloca (inalloca). We would clobber ESP in the epilogue
and end up returning to outer space.

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

8 years agoStop linking all target libraries in llvm-nm and llvm-objdump.
Pete Cooper [Wed, 7 Oct 2015 22:39:17 +0000 (22:39 +0000)]
Stop linking all target libraries in llvm-nm and llvm-objdump.

llvm-nm only needs the target to parse module level assembly in bitcode.  It doesn't need a disassembler or codegen.

llvm-objdump needs to be able to disassemble a file, but doesn't need asm parsers or codegen.

This reduces the sizes of these tools by a few MB each, depending on how many backends are linked in.

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

8 years ago[Orc] Enable user supplied partitioning functors in the CompileOnDemand layer.
Lang Hames [Wed, 7 Oct 2015 21:53:41 +0000 (21:53 +0000)]
[Orc] Enable user supplied partitioning functors in the CompileOnDemand layer.

Previously the CompileOnDemand layer always created single-function partitions.
In theory this new API allows for more interesting partitions, though this has
not been well tested yet.

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

8 years ago[WinEH] Refer to filter funclets using their symbol-table symbol
David Majnemer [Wed, 7 Oct 2015 21:34:00 +0000 (21:34 +0000)]
[WinEH] Refer to filter funclets using their symbol-table symbol

The relocation for the filter funclet will be against a symbol table
entry for a function instead of the section, making it easier to
understand what is going on.

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

8 years ago[RS4GC] Use AssertingVH for RematerializedValueMapTy, NFCI
Sanjoy Das [Wed, 7 Oct 2015 21:32:35 +0000 (21:32 +0000)]
[RS4GC] Use AssertingVH for RematerializedValueMapTy, NFCI

Reviewers: reames, swaroop.sridhar

Subscribers: llvm-commits

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

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

8 years ago[WinEH] Undo the effect of r249578 for 32-bit
Reid Kleckner [Wed, 7 Oct 2015 21:13:15 +0000 (21:13 +0000)]
[WinEH] Undo the effect of r249578 for 32-bit

The __CxxFrameHandler3 tables for 32-bit are supposed to hold stack
offsets relative to EBP, not ESP. I blindly updated the win-catchpad.ll
test case, and immediately noticed that 32-bit catching stopped working.

While I'm at it, move the frame index to frame offset WinEH table logic
out of PEI.  PEI shouldn't have to know about WinEHFuncInfo. I realized
we can calculate frame index offsets just fine from the table printer.

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

8 years ago[WinEH] Remove unreachable blocks before preparation
David Majnemer [Wed, 7 Oct 2015 21:08:25 +0000 (21:08 +0000)]
[WinEH] Remove unreachable blocks before preparation

We remove unreachable blocks because it is pointless to consider them
for coloring.  However, we still had stale pointers to these blocks in
some data structures after we removed them from the function.

Instead, remove the unreachable blocks before attempting to do anything
with the function.

This fixes PR25099.

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

8 years agoSupport: Stop using iplist in Recycler
Duncan P. N. Exon Smith [Wed, 7 Oct 2015 20:49:09 +0000 (20:49 +0000)]
Support: Stop using iplist in Recycler

Recycler just needs a singly-linked list, and it takes less (and
simpler) code to hand-roll one of those than to build up the equivalent
`iplist_traits`.  In theory, this should speed things up a bit too, but
this is really just a drive-by cleanup so I haven't measured.

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

8 years agogit-clang-format r249548.
Rafael Espindola [Wed, 7 Oct 2015 20:32:24 +0000 (20:32 +0000)]
git-clang-format r249548.

Sorry for missing this the first time.

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

8 years ago[mips][FastISel] Factor out common code from switch statement. NFC
Vasileios Kalintiris [Wed, 7 Oct 2015 20:06:30 +0000 (20:06 +0000)]
[mips][FastISel] Factor out common code from switch statement. NFC

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

8 years agoIR: Create SymbolTableList wrapper around iplist, NFC
Duncan P. N. Exon Smith [Wed, 7 Oct 2015 20:05:10 +0000 (20:05 +0000)]
IR: Create SymbolTableList wrapper around iplist, NFC

Create `SymbolTableList`, a wrapper around `iplist` for lists that
automatically manage a symbol table.  This commit reduces a ton of code
duplication between the six traits classes that were used previously.

As a drive by, reduce the number of template parameters from 2 to 1 by
using a SymbolTableListParentType metafunction (I originally had this as
a separate commit, but it touched most of the same lines so I squashed
them).

I'm in the process of trying to remove the UB in `createSentinel()` (see
the FIXMEs I added for `ilist_embedded_sentinel_traits` and
`ilist_half_embedded_sentinel_traits`).  My eventual goal is to separate
the list logic into a base class layer that knows nothing about (and
isn't templated on) the downcasted nodes -- removing the need to invoke
UB -- but for now I'm just trying to get a handle on all the current use
cases (and cleaning things up as I see them).

Besides these six SymbolTable lists, there are two others that use the
addNode/removeNode/transferNodes() hooks: the `MachineInstruction` and
`MachineBasicBlock` lists.  Ideally there'll be a way to factor these
hooks out of the low-level API entirely, but I'm not quite there yet.

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

8 years ago[IRBuilder] Add gc.statepoint related methods to IRBuilder
Sanjoy Das [Wed, 7 Oct 2015 19:52:12 +0000 (19:52 +0000)]
[IRBuilder] Add gc.statepoint related methods to IRBuilder

Summary:
This adds some more routines to `IRBuilder` around creating calls and
invokes to `gc.statepoint`.  These will be used later.

Reviewers: reames, swaroop.sridhar

Subscribers: sanjoy, llvm-commits

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

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

8 years ago[mips][FastISel] Use ternary operator to select opcode. NFC
Vasileios Kalintiris [Wed, 7 Oct 2015 19:43:31 +0000 (19:43 +0000)]
[mips][FastISel] Use ternary operator to select opcode. NFC

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

8 years ago[WinEH] Set NoModuleLevelChanges in clone flags
Joseph Tremoulet [Wed, 7 Oct 2015 19:29:56 +0000 (19:29 +0000)]
[WinEH] Set NoModuleLevelChanges in clone flags

Summary:
This is necessary to keep the cloner from making bogus copies of debug
metadata attached to the IR it is cloning.
Also, avoid running RemapInstruction over all instructions in the common
case that no cloning was performed.

Reviewers: rnk, andrew.w.kaylor, majnemer

Subscribers: llvm-commits

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

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

8 years agoUse SpecificBumpPtrAllocator to simplify the MCSeciton destruction.
Rafael Espindola [Wed, 7 Oct 2015 19:08:19 +0000 (19:08 +0000)]
Use SpecificBumpPtrAllocator to simplify the MCSeciton destruction.

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

8 years ago[X86]Update test to use FileCheck.
Kevin B. Smith [Wed, 7 Oct 2015 18:21:41 +0000 (18:21 +0000)]
[X86]Update test to use FileCheck.
Updates this test to use FileCheck and a single llc invocation rather than
3 llc invocations and grep.

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

8 years agoRevert "Revert "This patch builds on top of D13378 to handle constant condition.""
Mehdi Amini [Wed, 7 Oct 2015 18:14:25 +0000 (18:14 +0000)]
Revert "Revert "This patch builds on top of D13378 to handle constant condition.""

This reverts commit r249528 and reapply r249431. The fix for the
fallout has been commited in r249575.

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

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

8 years ago[mips][FastISel] Simple refactoring of MipsFastISel::emitLogicalOP(). NFC.
Vasileios Kalintiris [Wed, 7 Oct 2015 18:14:24 +0000 (18:14 +0000)]
[mips][FastISel] Simple refactoring of MipsFastISel::emitLogicalOP(). NFC.

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

8 years ago[AArch64] Fold a floating-point divide by power of two into fp conversion.
Chad Rosier [Wed, 7 Oct 2015 17:51:37 +0000 (17:51 +0000)]
[AArch64] Fold a floating-point divide by power of two into fp conversion.

Part of http://reviews.llvm.org/D13442

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

8 years ago[WinEH] Fix two minor issues in __CxxFrameHandler3 tables
Reid Kleckner [Wed, 7 Oct 2015 17:49:32 +0000 (17:49 +0000)]
[WinEH] Fix two minor issues in __CxxFrameHandler3 tables

There was an off-by-one bug in ip2state tables which manifested when one
call immediately preceded the try-range of the next. The return address
of the previous call would appear to be within the try range of the next
scope, resulting in extra destructors or catches running.

We also computed the wrong offset for catch parameter stack objects. The
offset should be from RSP, not from RBP.

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

8 years agoAMDGPU: Fix missing implicit m0 uses on movrel instructions
Matt Arsenault [Wed, 7 Oct 2015 17:46:32 +0000 (17:46 +0000)]
AMDGPU: Fix missing implicit m0 uses on movrel instructions

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

8 years ago[AArch64] Fold a floating-point multiply by power of two into fp conversion.
Chad Rosier [Wed, 7 Oct 2015 17:39:18 +0000 (17:39 +0000)]
[AArch64] Fold a floating-point multiply by power of two into fp conversion.

Part of http://reviews.llvm.org/D13442

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

8 years ago[IndVars] Preserve LCSSA in `eliminateIdentitySCEV`
Sanjoy Das [Wed, 7 Oct 2015 17:38:31 +0000 (17:38 +0000)]
[IndVars] Preserve LCSSA in `eliminateIdentitySCEV`

Summary:
After r249211, SCEV can see through some LCSSA phis.  Add a
`replacementPreservesLCSSAForm` check before replacing uses of these phi
nodes with a simplified use of the induction variable to avoid breaking
LCSSA.

Fixes 25047.

Depends on D13460.

Reviewers: atrick, hfinkel

Subscribers: llvm-commits

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

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

8 years ago[SCEV] Use some C++11'ism, NFC
Sanjoy Das [Wed, 7 Oct 2015 17:38:25 +0000 (17:38 +0000)]
[SCEV] Use some C++11'ism, NFC

Summary:

Subscribers: llvm-commits

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

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

8 years ago[ARM] Promote helper function to SelectionDAG.
Chad Rosier [Wed, 7 Oct 2015 17:28:58 +0000 (17:28 +0000)]
[ARM] Promote helper function to SelectionDAG.

I'll be using the function in a similar combine for AArch64.  The helper was
also improved to handle undef values.

Part of http://reviews.llvm.org/D13442

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

8 years agoTest commit access. Fixed comment to have correct input parameter name and
Kevin B. Smith [Wed, 7 Oct 2015 17:24:25 +0000 (17:24 +0000)]
Test commit access. Fixed comment to have correct input parameter name and
period termination.

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

8 years ago[WinEH] Update CoreCLR EH for catchpad MBBs
Joseph Tremoulet [Wed, 7 Oct 2015 17:16:25 +0000 (17:16 +0000)]
[WinEH] Update CoreCLR EH for catchpad MBBs

Summary:
Set the pad MBB as a funclet entry for CoreCLR as well as MSVCCXX, and
update state numbering to put the catchpad block rather than its normal
successor into the unwind map.

Reviewers: majnemer

Subscribers: llvm-commits

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

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

8 years ago[ARM] Use correct half-precision functions in EABI mode
Oliver Stannard [Wed, 7 Oct 2015 16:58:49 +0000 (16:58 +0000)]
[ARM] Use correct half-precision functions in EABI mode

The ARM RTABI defines the half- to single-precision float conversion functions
with an __aeabi prefix, but libgcc only has them with a __gnu prefix. Therefore
we need to emit the __aeabi version when compiling with an eabi or eabihf
triple, and the __gnu version with a gnueabi or gnueabihf triple.

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

8 years agoMove test back to Generic now it's fixed the right way (thanks Eric!)
David Blaikie [Wed, 7 Oct 2015 16:26:28 +0000 (16:26 +0000)]
Move test back to Generic now it's fixed the right way (thanks Eric!)

I knee-jerk tried to fix this in completely the wrong way - it's not an
CPU limitation, but an OS/object file type one, so moving it
into a CPU-specific classification didn't help at all.

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

8 years ago[ARM] Prevent PerformVDIVCombine from combining a vcvt/vdiv with 8 lanes.
Chad Rosier [Wed, 7 Oct 2015 16:15:40 +0000 (16:15 +0000)]
[ARM] Prevent PerformVDIVCombine from combining a vcvt/vdiv with 8 lanes.

This would result in a crash since the vcvt used does not support v8i32 types.

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

8 years agoTeach computeKnownBits to use new align attribute/metadata
Artur Pilipenko [Wed, 7 Oct 2015 16:01:18 +0000 (16:01 +0000)]
Teach computeKnownBits to use new align attribute/metadata

Reviewed By: reames

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

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

8 years ago[ARM][AArch64] Only lower to interleaved load/store if the target has NEON
Jeroen Ketema [Wed, 7 Oct 2015 14:53:29 +0000 (14:53 +0000)]
[ARM][AArch64] Only lower to interleaved load/store if the target has NEON

Without an additional check for NEON, the compiler crashes during
legalization of NEON ldN/stN.

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

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

8 years agoUse non virtual destructors for sections.
Rafael Espindola [Wed, 7 Oct 2015 13:46:06 +0000 (13:46 +0000)]
Use non virtual destructors for sections.

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

8 years ago[ARM] Push more complex check down to reduce compile time. NFC.
Chad Rosier [Wed, 7 Oct 2015 13:40:44 +0000 (13:40 +0000)]
[ARM] Push more complex check down to reduce compile time. NFC.

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

8 years agoDon't repeat names in comments and don't indent in namespaces. NFC.
Rafael Espindola [Wed, 7 Oct 2015 13:38:49 +0000 (13:38 +0000)]
Don't repeat names in comments and don't indent in namespaces. NFC.

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

8 years agoRevert: r249536 - Testing commit access with a trival whitespace change.
Scott Egerton [Wed, 7 Oct 2015 10:57:06 +0000 (10:57 +0000)]
Revert: r249536 - Testing commit access with a trival whitespace change.

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

8 years agoTesting commit access with a trival whitespace change.
Scott Egerton [Wed, 7 Oct 2015 10:49:49 +0000 (10:49 +0000)]
Testing commit access with a trival whitespace change.

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

8 years agoRevert "This patch builds on top of D13378 to handle constant condition."
James Molloy [Wed, 7 Oct 2015 09:03:34 +0000 (09:03 +0000)]
Revert "This patch builds on top of D13378 to handle constant condition."

This reverts commit r249431. This caused failures in sqlite3: http://lab.llvm.org:8011/builders/clang-native-arm-lnt/builds/14453

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

8 years ago[EarlyCSE] Fix handling of target memory intrinsics for CSE'ing loads.
Arnaud A. de Grandmaison [Wed, 7 Oct 2015 07:41:29 +0000 (07:41 +0000)]
[EarlyCSE] Fix handling of target memory intrinsics for CSE'ing loads.

Summary:
Some target intrinsics can access multiple elements, using the pointer as a
base address (e.g. AArch64 ld4). When trying to CSE such instructions,
it must be checked the available value comes from a compatible instruction
because the pointer is not enough to discriminate whether the value is
correct.

Reviewers: ssijaric

Subscribers: mcrosier, llvm-commits, aemerson

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

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

8 years ago[X86] Emit .cfi_escape GNU_ARGS_SIZE when adjusting the stack before calls
Michael Kuperstein [Wed, 7 Oct 2015 07:01:31 +0000 (07:01 +0000)]
[X86] Emit .cfi_escape GNU_ARGS_SIZE when adjusting the stack before calls

When outgoing function arguments are passed using push instructions, and EH
is enabled, we may need to indicate to the stack unwinder that the stack
pointer was adjusted before the call.

This should fix the exception handling issues in PR24792.

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

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

8 years agoAVX512: Change encoding of vpshuflw and vpshufhw instructions. Implement WIG as W0...
Igor Breger [Wed, 7 Oct 2015 06:31:18 +0000 (06:31 +0000)]
AVX512: Change encoding of vpshuflw and vpshufhw instructions. Implement WIG as W0 and not W1, like all other instruction have been implemented.
Add encoding tests.

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

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

8 years ago[RS4GC] Remove an unnecessary assert & related variables
Sanjoy Das [Wed, 7 Oct 2015 02:39:27 +0000 (02:39 +0000)]
[RS4GC] Remove an unnecessary assert & related variables

I don't think this assert adds much value, and removing it and related
variables avoids an "unused variable" warning in release builds.

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

8 years ago[OperandBundles] Add an accessor to get an operand bundle by tag
Sanjoy Das [Wed, 7 Oct 2015 02:39:24 +0000 (02:39 +0000)]
[OperandBundles] Add an accessor to get an operand bundle by tag

Not used at the moment, but will be used in a later change to
RewriteStatepointsForGC.

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

8 years ago[OperandBundles] Remove a useless accessor from OperandBundleUser
Sanjoy Das [Wed, 7 Oct 2015 02:39:21 +0000 (02:39 +0000)]
[OperandBundles] Remove a useless accessor from OperandBundleUser

Since the `const` version of `getOperandBundle` returns a value of the
same type as the non-`const` version, the non-`const` version is
redundant.

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

8 years ago[RS4GC] Cosmetic cleanup, NFC
Sanjoy Das [Wed, 7 Oct 2015 02:39:18 +0000 (02:39 +0000)]
[RS4GC] Cosmetic cleanup, NFC

Summary:
A series of cosmetic cleanup changes to RewriteStatepointsForGC:

  - Rename variables to LLVM style
  - Remove some redundant asserts
  - Remove an unsued `Pass *` parameter
  - Remove unnecessary variables
  - Use C++11 idioms where applicable
  - Pass CallSite by value, not reference

Reviewers: reames, swaroop.sridhar

Subscribers: llvm-commits, sanjoy

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

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

8 years agoRemove the comdat-ness from the testcase as it won't lower properly
Eric Christopher [Wed, 7 Oct 2015 01:52:33 +0000 (01:52 +0000)]
Remove the comdat-ness from the testcase as it won't lower properly
on darwin with it since darwin doesn't have comdat and it isn't
necessary for the testcase.

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

8 years agoAMDGPU: Add comment for VOP2b operand class
Matt Arsenault [Wed, 7 Oct 2015 01:36:00 +0000 (01:36 +0000)]
AMDGPU: Add comment for VOP2b operand class

Because of the constant bus requirement, it is never legal to
use a literal constant for these instructions despite the encoding
allowing it. This was already doing the right thing, but note why.

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

8 years agoUpdate test to use FileCheck and clean up run lines to match the
Eric Christopher [Wed, 7 Oct 2015 01:21:49 +0000 (01:21 +0000)]
Update test to use FileCheck and clean up run lines to match the
expected behavior.

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

8 years agoAMDGPU: Properly register passes
Matt Arsenault [Wed, 7 Oct 2015 00:42:53 +0000 (00:42 +0000)]
AMDGPU: Properly register passes

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

8 years agoAMDGPU: Use explicit register size indirect pseudos
Matt Arsenault [Wed, 7 Oct 2015 00:42:51 +0000 (00:42 +0000)]
AMDGPU: Use explicit register size indirect pseudos

This stops using an unknown reg class operand.

Currently build_vector selection has a broken looking check
where it tries to use a VGPR reg class and an SGPR one if it
sees an SGPR use.

With the source operand has an explicit VGPR class,
illegal copies will be inserted that SIFixSGPRCopies will take care
of normally later, which will allow removing the weird check
of build_vector users. Without this, when removed v_movrels_b32 would
still be emitted even though all of the values were only stored in
SGPRs.

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

8 years agoAMDGPU: Remove inferRegClassFromUses / inferRegClassFromDefs
Matt Arsenault [Wed, 7 Oct 2015 00:42:31 +0000 (00:42 +0000)]
AMDGPU: Remove inferRegClassFromUses / inferRegClassFromDefs

I'm not sure why this would be necessary, and no tests fail with
them removed. Looking at the uses is suspect as well because
the use reg classes will likely change when the users are moved
as a result of moving this instruction.

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

8 years ago[SEH] Add llvm.eh.exceptioncode intrinsic
Reid Kleckner [Wed, 7 Oct 2015 00:27:33 +0000 (00:27 +0000)]
[SEH] Add llvm.eh.exceptioncode intrinsic

This will support the Clang __exception_code intrinsic.

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

8 years agoInstCombine: Fold comparisons between unguessable allocas and other pointers
Hans Wennborg [Wed, 7 Oct 2015 00:20:07 +0000 (00:20 +0000)]
InstCombine: Fold comparisons between unguessable allocas and other pointers

This will allow us to optimize code such as:

  int f(int *p) {
    int x;
    return p == &x;
  }

as well as:

  int *allocate(void);
  int f() {
    int x;
    int *p = allocate();
    return p == &x;
  }

The folding can only be done under certain circumstances. Even though p and &x
cannot alias, the comparison must still return true if the pointer
representations are equal. If a user successfully generates a p that's a
correct guess for &x, comparison should return true even though p is an invalid
pointer.

This patch argues that if the address of the alloca isn't observable outside the
function, the function can act as-if the address is impossible to guess from the
outside. The tricky part is keeping the act consistent: if we fold p == &x to
false in one place, we must make sure to fold any other comparisons based on
those pointers similarly. To ensure that, we only fold when &x is involved
exactly once in comparison instructions.

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

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

8 years agoMove test to X86-specific due to some IR invalid on other targets
David Blaikie [Wed, 7 Oct 2015 00:17:31 +0000 (00:17 +0000)]
Move test to X86-specific due to some IR invalid on other targets

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

8 years agoDebugInfo: Include the decl_line/decl_file in subprogram definitions if they differ...
David Blaikie [Wed, 7 Oct 2015 00:04:16 +0000 (00:04 +0000)]
DebugInfo: Include the decl_line/decl_file in subprogram definitions if they differ from those in the declaration

This is handy for some AutoFDO stuff, and seems like a minor improvement
to correctness (otherwise a debug info consumer might think the decl
line/file of the def was the same as that of the declaration - though
what a consumer might use that for, I'm not sure - maybe "list <func>"
would've misbehaved with the old behavior?) and at a minor cost (in my
experiment, with fission, without type units, without compression, 0.01%
growth in debug info in the executable/objects, 0.02% growth in the .dwo
files).

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

8 years ago[WinEH] Create a separate MBB for funclet prologues
David Majnemer [Tue, 6 Oct 2015 23:31:59 +0000 (23:31 +0000)]
[WinEH] Create a separate MBB for funclet prologues

Our current emission strategy is to emit the funclet prologue in the
CatchPad's normal destination.  This is problematic because
intra-funclet control flow to the normal destination is not erroneous
and results in us reevaluating the prologue if said control flow is
taken.

Instead, use the CatchPad's location for the funclet prologue.  This
correctly models our desire to have unwind edges evaluate the prologue
but edges to the normal destination result in typical control flow.

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

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

8 years agoFix Clang-tidy modernize-use-nullptr warnings in source directories and generated...
Hans Wennborg [Tue, 6 Oct 2015 23:24:35 +0000 (23:24 +0000)]
Fix Clang-tidy modernize-use-nullptr warnings in source directories and generated files; other minor cleanups.

Patch by Eugene Zelenko!

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

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

8 years ago[Orc] Teach the CompileOnDemand layer to clone aliases.
Lang Hames [Tue, 6 Oct 2015 22:55:05 +0000 (22:55 +0000)]
[Orc] Teach the CompileOnDemand layer to clone aliases.

This allows modules containing aliases to be lazily jit'd. Previously these
failed with missing symbol errors because the aliases weren't cloned from the
original module.

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

8 years agoIR: Use auto for iterators, NFC
Duncan P. N. Exon Smith [Tue, 6 Oct 2015 22:37:47 +0000 (22:37 +0000)]
IR: Use auto for iterators, NFC

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

8 years agoFix two bugs in llvm-objdump’s printing of Objective-C meta data
Kevin Enderby [Tue, 6 Oct 2015 22:27:08 +0000 (22:27 +0000)]
Fix two bugs in llvm-objdump’s printing of Objective-C meta data
from malformed Mach-O files that caused crashes.

We recently got about 700 malformed Mach-O files which we have
been using the improve the robustness of tools that deal with reading
data from object files.  These resulted in about 20 small bug fixes to
the darwin based tools.

The goal here is to also improve the robustness of llvm-objdump and
this is the first two fixes.  In talking with Tim Northover the approach
we thought might be best is to:

1) Only include tests for the malformed Mach-O files that cause crashes
(not all 700+ tests).
2) The test should only contain the command line option that caused the
crash and not all the others that don’t matter.
3) There should be only one line for the FileCheck that is past the point
of the crash if possible and if possible indicates the malformation.

Again the goal is to fix crashes and not so much care about how the
printing of malformed data comes out.

Tim also suggested if we really wanted to add test cases for all 700+
malformed Mach-O files putting them in the regression tests might be
an option.  But many of these do not cause crashes.

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

8 years agoIR: Remove unnecessary TraitsClass typedef, NFC
Duncan P. N. Exon Smith [Tue, 6 Oct 2015 22:14:06 +0000 (22:14 +0000)]
IR: Remove unnecessary TraitsClass typedef, NFC

No classes are specializing the symbol table traits, so no need to look
through a typedef for class API.  Make a few more functions private
since only SymbolTableListTraits should be using them.

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

8 years agoCodeGen: s/protected:/private:/ in MachineBasicBlock, NFC
Duncan P. N. Exon Smith [Tue, 6 Oct 2015 21:48:31 +0000 (21:48 +0000)]
CodeGen: s/protected:/private:/ in MachineBasicBlock, NFC

Nothing inherits from `MachineBasicBlock`, so this should have no real
functionality change.  Just makes the code easier to understand.

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

8 years ago[IndVars] Don't break dominance in `eliminateIdentitySCEV`
Sanjoy Das [Tue, 6 Oct 2015 21:44:49 +0000 (21:44 +0000)]
[IndVars] Don't break dominance in `eliminateIdentitySCEV`

Summary:
After r249211, `getSCEV(X) == getSCEV(Y)` does not guarantee that X and
Y are related in the dominator tree, even if X is an operand to Y (I've
included a toy example in comments, and a real example as a test case).

This commit changes `SimplifyIndVar` to require a `DominatorTree`.  I
don't think this is a problem because `ScalarEvolution` requires it
anyway.

Fixes PR25051.

Depends on D13459.

Reviewers: atrick, hfinkel

Subscribers: joker.eph, llvm-commits, sanjoy

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

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

8 years ago[IndVars] Extract out eliminateIdentitySCEV, NFC
Sanjoy Das [Tue, 6 Oct 2015 21:44:39 +0000 (21:44 +0000)]
[IndVars] Extract out eliminateIdentitySCEV, NFC

Summary:
Reflow a comment while at it.

Subscribers: llvm-commits

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

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

8 years agoIR: Remove unnecessary specialization of getSymTab(), NFC
Duncan P. N. Exon Smith [Tue, 6 Oct 2015 21:31:07 +0000 (21:31 +0000)]
IR: Remove unnecessary specialization of getSymTab(), NFC

The only specializations of `getSymTab()` were identical to the default
defined in `SymbolTableListTraits::getSymTab()`.  Remove the
specializations, and stop treating it like a configuration point.  Just
to be sure no one else accesses this, make it private.

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