oota-llvm.git
9 years agoFix tests.
Peter Collingbourne [Mon, 26 Oct 2015 20:49:49 +0000 (20:49 +0000)]
Fix tests.

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

9 years agoARM/ELF: Restore original (pre-r251322) logic for deciding whether to use GOT.
Peter Collingbourne [Mon, 26 Oct 2015 20:46:44 +0000 (20:46 +0000)]
ARM/ELF: Restore original (pre-r251322) logic for deciding whether to use GOT.

Unbreaks linking with gold, which cannot resolve direct relocations referring
to global symbols.

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

9 years ago[LLVMSymbolize] Use symbol table only if function linkage name was requested.
Alexey Samsonov [Mon, 26 Oct 2015 20:12:29 +0000 (20:12 +0000)]
[LLVMSymbolize] Use symbol table only if function linkage name was requested.

Now it's enough to just specify -functions=short without additionally
providing -use-symbol-table=false.

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

9 years agoFix build error by fully qualifying llvm::make_unique.
Alexey Samsonov [Mon, 26 Oct 2015 20:12:27 +0000 (20:12 +0000)]
Fix build error by fully qualifying llvm::make_unique.

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

9 years agoOptimize StringTableBuilder.
Rui Ueyama [Mon, 26 Oct 2015 19:58:29 +0000 (19:58 +0000)]
Optimize StringTableBuilder.

This is a patch to improve StringTableBuilder's performance. That class'
finalize function is very hot particularly in LLD because the function
does tail-merge strings in string tables or SHF_MERGE sections.

Generic std::sort-style sorter is not efficient for sorting strings.
The function implemented in this patch seems to be more efficient.

Here's a benchmark of LLD to link Clang with or without this patch.
The numbers are medians of 50 runs.

-O0
real 0m0.455s
real 0m0.430s (5.5% faster)

-O3
real 0m0.487s
real 0m0.452s (7.2% faster)

Since that is a benchmark of the whole linker, the speedup of
StringTableBuilder itself is much more than that.

http://reviews.llvm.org/D14053

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

9 years ago[LLVMSymbolize] Use std::unique_ptr more extensively to clarify ownership.
Alexey Samsonov [Mon, 26 Oct 2015 19:41:23 +0000 (19:41 +0000)]
[LLVMSymbolize] Use std::unique_ptr more extensively to clarify ownership.

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

9 years ago[RS4GC] Strip noalias attribute after statepoint rewrite
Igor Laevsky [Mon, 26 Oct 2015 19:06:01 +0000 (19:06 +0000)]
[RS4GC] Strip noalias attribute after statepoint rewrite

We should remove noalias along with dereference and dereference_or_null attributes
because statepoint could potentially touch the entire heap including noalias objects.

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

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

9 years agoSamplePGO - Add optimization reports.
Diego Novillo [Mon, 26 Oct 2015 18:52:53 +0000 (18:52 +0000)]
SamplePGO - Add optimization reports.

This adds a couple of optimization remarks to the SamplePGO
transformation. When it decides to inline a hot function (to mimic the
inline stack and repeat useful inline decisions in the original build).

It will also report branch destinations. For instance, given the code
fragment:

     6      if (i < 1000)
     7        sum -= i;
     8      else
     9        sum += -i * rand();

If the 'else' branch is taken most of the time, building this code with
-Rpass=sample-profile will produce:

a.cc:9:14: remark: most popular destination for conditional branches at small.cc:6:9 [-Rpass=sample-profile]
      sum += -i * rand();
             ^

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

9 years agoRemove assert(false) in favor of asserting the if conditional it is contained within.
David Blaikie [Mon, 26 Oct 2015 18:41:13 +0000 (18:41 +0000)]
Remove assert(false) in favor of asserting the if conditional it is contained within.

Also adjust the code to avoid 3 redundant map lookups.

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

9 years agoMove the canonical header to the top of its matching cpp file as per coding convention
David Blaikie [Mon, 26 Oct 2015 18:40:56 +0000 (18:40 +0000)]
Move the canonical header to the top of its matching cpp file as per coding convention

This ensures that the header will be verified to be standalone (and
avoid mistakes like the one fixed in r251178)

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

9 years agoAdd an (optional) identification block in the bitcode
Mehdi Amini [Mon, 26 Oct 2015 18:37:00 +0000 (18:37 +0000)]
Add an (optional) identification block in the bitcode

Processing bitcode from a different LLVM version can lead to
unexpected behavior. The LLVM project guarantees autoupdating
bitcode from a previous minor revision for the same major, but
can't make any promise when reading bitcode generated from a
either a non-released LLVM, a vendor toolchain, or a "future"
LLVM release. This patch aims at being more user-friendly and
allows a bitcode produce to emit an optional block at the
beginning of the bitcode that will contains an opaque string
intended to describe the bitcode producer information. The
bitcode reader will dump this information alongside any error it
reports.

The optional block also includes an "epoch" number, monotonically
increasing when incompatible changes are made to the bitcode. The
reader will reject bitcode whose epoch is different from the one
expected.

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

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

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

9 years ago[safestack] Fast access to the unsafe stack pointer on AArch64/Android.
Evgeniy Stepanov [Mon, 26 Oct 2015 18:28:25 +0000 (18:28 +0000)]
[safestack] Fast access to the unsafe stack pointer on AArch64/Android.

Android libc provides a fixed TLS slot for the unsafe stack pointer,
and this change implements direct access to that slot on AArch64 via
__builtin_thread_pointer() + offset.

This change also moves more code into TargetLowering and its
target-specific subclasses to get rid of target-specific codegen
in SafeStackPass.

This change does not touch the ARM backend because ARM lowers
builting_thread_pointer as aeabi_read_tp, which is not available
on Android.

The previous iteration of this change was reverted in r250461. This
version leaves the generic, compiler-rt based implementation in
SafeStack.cpp instead of moving it to TargetLoweringBase in order to
allow testing without a TargetMachine.

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

9 years agoBitstreamWriter: Fix integer overflow.
Peter Collingbourne [Mon, 26 Oct 2015 18:23:21 +0000 (18:23 +0000)]
BitstreamWriter: Fix integer overflow.

We were previously overflowing a 32-bit multiply operation when emitting large
(>512MB) bitcode files, resulting in corrupted bitcode. Fix by extending
one of the operands to 64 bits.

There are a few other 32-bit integer types in this code that seem like they
also ought to be extended to 64 bits; this will be done separately.

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

9 years agoARM/ELF: Better codegen for global variable addresses.
Peter Collingbourne [Mon, 26 Oct 2015 18:23:16 +0000 (18:23 +0000)]
ARM/ELF: Better codegen for global variable addresses.

In PIC mode we were previously computing global variable addresses (or GOT
entry addresses) by adding the PC, the PC-relative GOT displacement and
the GOT-relative symbol/GOT entry displacement. Because the latter two
displacements are fixed, we ended up performing one more addition than
necessary.

This change causes us to compute addresses using a single PC-relative
displacement, resulting in a shorter code sequence. This reduces code size
by about 4% in a recent build of Chromium for Android.

As a result of this change we no longer need to compute the GOT base address
in the ARM backend, which allows us to remove the Global Base Reg pass and
SDAG lowering for the GOT.

We also now no longer use the GOT when addressing a symbol which is known
to be defined in the same linkage unit. Specifically, the symbol must have
either hidden visibility or a strong definition in the current module in
order to not use the the GOT.

This is a change from the previous behaviour where we would use the GOT to
address externally visible symbols defined in the same module. I think the
only cases where this could matter are cases involving symbol interposition,
but we don't really support that well anyway.

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

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

9 years agoCleanup test case debug info. NFC.
Diego Novillo [Mon, 26 Oct 2015 18:14:44 +0000 (18:14 +0000)]
Cleanup test case debug info. NFC.

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

9 years agoRefactor: Simplify boolean conditional return statements in lib/Transforms/Instrument...
Alexey Samsonov [Mon, 26 Oct 2015 18:06:40 +0000 (18:06 +0000)]
Refactor: Simplify boolean conditional return statements in lib/Transforms/Instrumentation

Summary: Use clang-tidy to simplify boolean conditional return statements.

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

Patch by Richard (legalize@xmission.com)!

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

9 years agoCheck the case that the numerator and denominator are both zeros when getting edge...
Cong Hou [Mon, 26 Oct 2015 18:00:17 +0000 (18:00 +0000)]
Check the case that the numerator and denominator are both zeros when getting edge probabilities in BPI and return 100% in this case.

This issue is triggered in PGO mode when bootstrapping LLVM. It seems that it is not guaranteed that edge weights are always greater than zero which are read from profile data.

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

9 years agoMove parts of llvm-symbolizer tool into LLVMSymbolize library.
Alexey Samsonov [Mon, 26 Oct 2015 17:56:12 +0000 (17:56 +0000)]
Move parts of llvm-symbolizer tool into LLVMSymbolize library.

Summary: See http://lists.llvm.org/pipermail/llvm-dev/2015-October/091624.html

Reviewers: echristo

Subscribers: llvm-commits, aizatsky

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

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

9 years ago[SystemZ] LTGFR use regclass should be GR32, not GR64.
Jonas Paulsson [Mon, 26 Oct 2015 15:03:49 +0000 (15:03 +0000)]
[SystemZ] LTGFR use regclass should be GR32, not GR64.

Discovered by testing int-cmp-44.ll with -verify-machineinstrs (added to
test run).

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

9 years ago[SystemZ] Also clear kill flag for index reg in splitMove().
Jonas Paulsson [Mon, 26 Oct 2015 15:03:41 +0000 (15:03 +0000)]
[SystemZ] Also clear kill flag for index reg in splitMove().

Discovered by running fp-move-05.ll with -verify-machineinstrs (added
to test case run).

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

9 years ago[SystemZ] Don't forget the CC def op on LTEBRCompare pseudos
Jonas Paulsson [Mon, 26 Oct 2015 15:03:32 +0000 (15:03 +0000)]
[SystemZ] Don't forget the CC def op on LTEBRCompare pseudos

Discovered by running fp-cmp-02.ll with -verify-machineinstrs (now added
to test run).

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

9 years ago[SystemZ] Tie operands in SystemZShorteInst if MI becomes 2-address.
Jonas Paulsson [Mon, 26 Oct 2015 15:03:07 +0000 (15:03 +0000)]
[SystemZ] Tie operands in SystemZShorteInst if MI becomes 2-address.

Discovered by testing fp-add-02.ll with -verify-machineinstrs.

Test case updated to always run with -verify-machineinstrs.

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

9 years ago[mips] Check for the correct error message in tests for interrupt attributes.
Vasileios Kalintiris [Mon, 26 Oct 2015 14:24:30 +0000 (14:24 +0000)]
[mips] Check for the correct error message in tests for interrupt attributes.

Instead of XFAIL-ing the tests with the wrong usage of the "interrupt"
attribute, we should check that we emit the correct error messages to
the user.

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

9 years ago[ValueTracking] Extend r251146 to catch a fairly common case
James Molloy [Mon, 26 Oct 2015 14:10:46 +0000 (14:10 +0000)]
[ValueTracking] Extend r251146 to catch a fairly common case

Even though we may not know the value of the shifter operand, it's possible we know the shifter operand is non-zero. This can allow us to infer more known bits - for example:

  %1 = load %p !range {1, 5}
  %2 = shl %q, %1

We don't know %1, but we do know that it is nonzero so %2[0] is known zero, and importantly %2 is known non-zero.

Calling isKnownNonZero is nontrivially expensive so use an Optional to run it lazily and cache its result.

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

9 years ago[SCEV] Fix issues found during the review of r251283. NFC.
Silviu Baranga [Mon, 26 Oct 2015 13:50:06 +0000 (13:50 +0000)]
[SCEV] Fix issues found during the review of r251283. NFC.

Summary:
Replace (const SCEVAddRecExpr *) with cast<SCEVAddRecExpr>.

Rename SCEVApplyRewriter to SCEVLoopAddRecRewriter (which is a more
appropriate name) since the description is "takes a scalar evolution
expression and applies the Map (Loop -> SCEV) to all AddRecExprs."

Subscribers: llvm-commits, sanjoy

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

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

9 years agoLoop Vectorizer - skipping "bitcast" before GEP
Elena Demikhovsky [Mon, 26 Oct 2015 13:42:41 +0000 (13:42 +0000)]
Loop Vectorizer - skipping "bitcast" before GEP

Vectorization of memory instruction (Load/Store) is possible when the pointer is coming from GEP. The GEP analysis allows to estimate the profit.
In some cases we have a "bitcast" between GEP and memory instruction.
I added code that skips the "bitcast".

http://reviews.llvm.org/D13886

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

9 years agoTests: be slightly more specific to avoid conflict with path.
Tim Northover [Mon, 26 Oct 2015 13:40:03 +0000 (13:40 +0000)]
Tests: be slightly more specific to avoid conflict with path.

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

9 years agofix test errors (on windows) for commit r251287
Igor Breger [Mon, 26 Oct 2015 13:31:41 +0000 (13:31 +0000)]
fix test errors (on windows) for commit r251287

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

9 years agoAVX512: Enabled VPBROADCASTB lowering for v64i8 vectors.
Igor Breger [Mon, 26 Oct 2015 13:01:02 +0000 (13:01 +0000)]
AVX512: Enabled VPBROADCASTB lowering for v64i8 vectors.

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

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

9 years ago[mips] Interrupt attribute support for mips32r2+.
Vasileios Kalintiris [Mon, 26 Oct 2015 12:38:43 +0000 (12:38 +0000)]
[mips] Interrupt attribute support for mips32r2+.

Summary:
This patch adds support for using the "interrupt" attribute on Mips
for interrupt handling functions. At this time only mips32r2+ with the
o32 ABI with the static relocation model is supported. Unsupported
configurations will be rejected

Patch by Simon Dardis (+ clang-format & some trivial changes to follow the
LLVM coding standards by me).

Reviewers: mpf, dsanders

Subscribers: dsanders, vkalintiris, llvm-commits

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

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

9 years agoAVX-512: Use correct extract vector length.
Igor Breger [Mon, 26 Oct 2015 12:26:34 +0000 (12:26 +0000)]
AVX-512: Use correct extract vector length.

Bug https://llvm.org/bugs/show_bug.cgi?id=25318

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

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

9 years ago[SCEV] Factor out common visiting patterns for SCEV rewriters. NFC.
Silviu Baranga [Mon, 26 Oct 2015 11:18:31 +0000 (11:18 +0000)]
[SCEV] Factor out common visiting patterns for SCEV rewriters. NFC.

Summary:
Add a SCEVRewriteVisitor class which contains the common
visiting patterns used when rewriting SCEVs.

SCEVParameterRewriter and SCEVApplyRewriter now inherit
from SCEVRewriteVisitor (and are therefore much simpler).

Reviewers: anemet, mzolotukhin, sanjoy

Subscribers: rengolin, llvm-commits, sanjoy

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

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

9 years ago[InstCombine] Teach instcombine not to create extra PHI nodes when folding GEPs
Silviu Baranga [Mon, 26 Oct 2015 10:25:05 +0000 (10:25 +0000)]
[InstCombine] Teach instcombine not to create extra PHI nodes when folding GEPs

Summary:
InstCombine tries to transform GEP(PHI(GEP1, GEP2, ..)) into GEP(GEP(PHI(...))
when possible. However, this may leave the old PHI node around. Even if we
do end up folding the GEPs, having an extra PHI node might not be beneficial.

This change makes the transformation more conservative. We now only do this if
the PHI has only one use, and can therefore be removed after the transformation.

Reviewers: jmolloy, majnemer

Subscribers: mcrosier, mssimpso, llvm-commits

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

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

9 years ago[ARM] Handle the inline asm constraint type 'o'
James Molloy [Mon, 26 Oct 2015 10:04:52 +0000 (10:04 +0000)]
[ARM] Handle the inline asm constraint type 'o'

This means "memory with offset" and requires very little plumbing to get working. This fixes PR25317.

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

9 years agoDrop code after unreachable. No functionality change.
Benjamin Kramer [Mon, 26 Oct 2015 09:55:45 +0000 (09:55 +0000)]
Drop code after unreachable. No functionality change.

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

9 years agoAVX512: Add AVX-512 not materializable instructions.
Igor Breger [Mon, 26 Oct 2015 08:37:12 +0000 (08:37 +0000)]
AVX512: Add AVX-512 not materializable instructions.
Otherwise value can be reused , despite its value could be changed - produces incorrect assembler.

https://llvm.org/bugs/show_bug.cgi?id=25270

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

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

9 years ago[Orc] Add license header to OrcTargetSupport.
Lang Hames [Mon, 26 Oct 2015 06:40:28 +0000 (06:40 +0000)]
[Orc] Add license header to OrcTargetSupport.

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

9 years ago[Orc] In the CompileOnDemand layer, wrap module ownership in order to preserve
Lang Hames [Mon, 26 Oct 2015 06:37:04 +0000 (06:37 +0000)]
[Orc] In the CompileOnDemand layer, wrap module ownership in order to preserve
the module pointer type passed in by the user.

The previous ownership scheme, where the user pointer was always moved into a
std::shared_ptr, breaks if the user passes in a raw pointer.

Discovered while working on the Orc C API, which should be landing shortly.
I expect to include a test-case with that.

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

9 years agoUpdate test to take into account for r251271.
David Majnemer [Mon, 26 Oct 2015 03:34:29 +0000 (03:34 +0000)]
Update test to take into account for r251271.

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

9 years ago[MC] Add support for GNU as-compatible binary operator precedence
David Majnemer [Mon, 26 Oct 2015 03:15:34 +0000 (03:15 +0000)]
[MC] Add support for GNU as-compatible binary operator precedence

GNU as and Darwin give the various binary operators different
precedence.  LLVM's MC supported the Darwin semantics but not the GNU
semantics.

This fixes PR25311.

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

9 years ago[MC] Don't crash when .word is given bogus values
David Majnemer [Mon, 26 Oct 2015 02:45:50 +0000 (02:45 +0000)]
[MC] Don't crash when .word is given bogus values

We didn't validate that the .word directive was given a sane value,
leading to crashes when we attempt to write out the object file.

Instead, perform some validation and issue a diagnostic pointing at the
start of the diagnostic.

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

9 years agoRegionInfo: Correctly expand regions
Tobias Grosser [Sun, 25 Oct 2015 22:55:59 +0000 (22:55 +0000)]
RegionInfo: Correctly expand regions

Instead of playing around with dominance to verify if the possible expansion of
a scop region is indeed a single entry single exit region, we now distinguish
two cases. In case we only append a basic block, all edges entering this basic
block need to have come from within the region that is expanded. In case we join
two regions, the source basic blocks of the edges that end at the entry node of
the region that is appended most be part of either the original region or the
region that is appended.

This change will be tested through Polly.

This fixes llvm.org/PR25242

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

9 years agoConvert assert(false) into llvm_unreachable where it makes sense.
Benjamin Kramer [Sun, 25 Oct 2015 22:28:27 +0000 (22:28 +0000)]
Convert assert(false) into llvm_unreachable where it makes sense.

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

9 years ago[X86][AVX] Regenerate tests.
Simon Pilgrim [Sun, 25 Oct 2015 21:47:09 +0000 (21:47 +0000)]
[X86][AVX] Regenerate tests.

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

9 years agodocs: document `x` mangling in LangRef
Saleem Abdulrasool [Sun, 25 Oct 2015 20:39:35 +0000 (20:39 +0000)]
docs: document `x` mangling in LangRef

Windows has two different mangling specifiers.  `x` is used on x86 for the `_`
UserLabelPrefix.  Others use `w` for the no UserLabelPrefix.

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

9 years ago[ScalarEvolution] Throw away dead code.
Davide Italiano [Sun, 25 Oct 2015 20:00:49 +0000 (20:00 +0000)]
[ScalarEvolution] Throw away dead code.

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

9 years ago[ScalarEvolution] Get rid of NDEBUG in header (correctly this time).
Davide Italiano [Sun, 25 Oct 2015 19:55:24 +0000 (19:55 +0000)]
[ScalarEvolution] Get rid of NDEBUG in header (correctly this time).

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

9 years ago[LCSSA] Unbreak build, don't reuse L; NFC
Sanjoy Das [Sun, 25 Oct 2015 19:27:17 +0000 (19:27 +0000)]
[LCSSA] Unbreak build, don't reuse L; NFC

The build broke in r251248.

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

9 years ago[ScalarEvolution] Get rid of NDEBUG in header.
Davide Italiano [Sun, 25 Oct 2015 19:13:36 +0000 (19:13 +0000)]
[ScalarEvolution] Get rid of NDEBUG in header.

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

9 years ago[LCSSA] Use range for loops; NFC
Sanjoy Das [Sun, 25 Oct 2015 19:08:32 +0000 (19:08 +0000)]
[LCSSA] Use range for loops; NFC

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

9 years ago[X86][SSE4A] Fix for EXTRQI shuffle lowering.
Simon Pilgrim [Sun, 25 Oct 2015 17:40:54 +0000 (17:40 +0000)]
[X86][SSE4A] Fix for EXTRQI shuffle lowering.

Incorrect range test - found during fuzz testing.

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

9 years ago[X86][SSE] Refreshed tests (missing AVX512 patterns)
Simon Pilgrim [Sun, 25 Oct 2015 15:39:22 +0000 (15:39 +0000)]
[X86][SSE] Refreshed tests (missing AVX512 patterns)

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

9 years agoScalarizer for masked.gather and masked.scatter intrinsics.
Elena Demikhovsky [Sun, 25 Oct 2015 15:37:55 +0000 (15:37 +0000)]
Scalarizer for masked.gather and masked.scatter intrinsics.
When the target does not support these intrinsics they should be converted to a chain of scalar load or store operations.
If the mask is not constant, the scalarizer will build a chain of conditional basic blocks.
I added isLegalMaskedGather() isLegalMaskedScatter() APIs.

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

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

9 years ago[X86][SSE] Added tests for shuffling through bitcasts.
Simon Pilgrim [Sun, 25 Oct 2015 15:32:04 +0000 (15:32 +0000)]
[X86][SSE] Added tests for shuffling through bitcasts.

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

9 years ago[X86][SSE] vector sext/zext tests - remove unnecessary mcpu arguments
Simon Pilgrim [Sun, 25 Oct 2015 12:15:00 +0000 (12:15 +0000)]
[X86][SSE] vector sext/zext tests - remove unnecessary mcpu arguments

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

9 years ago[X86][SSE] shift/rotate tests - remove unnecessary mcpu arguments and regenerate...
Simon Pilgrim [Sun, 25 Oct 2015 12:07:45 +0000 (12:07 +0000)]
[X86][SSE] shift/rotate tests - remove unnecessary mcpu arguments and regenerate/cleanup

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

9 years ago[X86] PMOV*X* tests - remove unnecessary mcpu arguments and regenerate
Simon Pilgrim [Sun, 25 Oct 2015 11:55:10 +0000 (11:55 +0000)]
[X86] PMOV*X* tests - remove unnecessary mcpu arguments and regenerate

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

9 years ago[X86] Stack folding tests - just use mtriple - no need for mcpu in these tests
Simon Pilgrim [Sun, 25 Oct 2015 11:42:46 +0000 (11:42 +0000)]
[X86] Stack folding tests - just use mtriple - no need for mcpu in these tests

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

9 years ago[X86] Use correct calling convention for MCU psABI libcalls
Michael Kuperstein [Sun, 25 Oct 2015 08:14:05 +0000 (08:14 +0000)]
[X86] Use correct calling convention for MCU psABI libcalls

When using the MCU psABI, compiler-generated library calls should pass
some parameters in-register. However, since inreg marking for x86 is currently
done by the front end, it will not be applied to backend-generated calls.

This is a workaround for PR3997, which describes a similar issue for -mregparm.

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

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

9 years ago[X86] Add support for elfiamcu triple
Michael Kuperstein [Sun, 25 Oct 2015 08:07:37 +0000 (08:07 +0000)]
[X86] Add support for elfiamcu triple

This adds support for the i?86-*-elfiamcu triple, which indicates the IAMCU psABI is used.

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

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

9 years agoRemove two unnecessary conversions from MVT to EVT. NFC
Craig Topper [Sun, 25 Oct 2015 03:15:29 +0000 (03:15 +0000)]
Remove two unnecessary conversions from MVT to EVT. NFC

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

9 years agoUse MVT::SimpleValueType instead of MVT in template parameter. NFC
Craig Topper [Sun, 25 Oct 2015 00:27:14 +0000 (00:27 +0000)]
Use MVT::SimpleValueType instead of MVT in template parameter. NFC

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

9 years agoSimplify boolean conditional return statements in tools/llvm-symbolizer.
Rafael Espindola [Sat, 24 Oct 2015 23:23:25 +0000 (23:23 +0000)]
Simplify boolean conditional return statements in tools/llvm-symbolizer.

Patch by Richard.

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

9 years agoSimplify boolean expressions in tools/llvm-objdump.
Rafael Espindola [Sat, 24 Oct 2015 23:19:10 +0000 (23:19 +0000)]
Simplify boolean expressions in tools/llvm-objdump.

Patch by Richard.

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

9 years agoRefactor: Simplify boolean conditional return statements in lib/CodeGen.
Rafael Espindola [Sat, 24 Oct 2015 23:11:13 +0000 (23:11 +0000)]
Refactor: Simplify boolean conditional return statements in lib/CodeGen.

Patch by Richard.

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

9 years ago[X86][SSE] Use lowerVectorShuffleWithUNPCK instead of custom matches.
Simon Pilgrim [Sat, 24 Oct 2015 22:45:04 +0000 (22:45 +0000)]
[X86][SSE] Use lowerVectorShuffleWithUNPCK instead of custom matches.

Most 128-bit and 256-bit shuffles were manually matching UNPCK patterns - use lowerVectorShuffleWithUNPCK to be more thorough.

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

9 years ago[Support] Add comment to explain why we can't drop NDEBUG.
Davide Italiano [Sat, 24 Oct 2015 22:15:32 +0000 (22:15 +0000)]
[Support] Add comment to explain why we can't drop NDEBUG.

Discussed with: Benjamin Kramer.

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

9 years ago[CodeGen] Get rid of NDEBUG to ensure structure stability.
Davide Italiano [Sat, 24 Oct 2015 22:09:54 +0000 (22:09 +0000)]
[CodeGen] Get rid of NDEBUG to ensure structure stability.

I think it's fine to keep this fields around in terms of overhead,
I wasn't able to measure any substantial regression while running the
test suite, but, in case this causes some regression I'm ready to revert
and work on an alternative solution.
This was tested building with clang/gcc both in Debug and Release mode
and passes the test-suite.

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

9 years ago[X86][SSE] lowerVectorShuffleWithUNPCK - use equivalent shuffle mask test.
Simon Pilgrim [Sat, 24 Oct 2015 20:48:08 +0000 (20:48 +0000)]
[X86][SSE] lowerVectorShuffleWithUNPCK - use equivalent shuffle mask test.

Use isShuffleEquivalent to match UNPCK shuffles - better support for build vector inputs.

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

9 years agoRefactor: Simplify boolean conditional return statements in lib/Transforms/Vectorize...
Michael Zolotukhin [Sat, 24 Oct 2015 20:16:42 +0000 (20:16 +0000)]
Refactor: Simplify boolean conditional return statements in lib/Transforms/Vectorize (NFC).

Summary: Use clang-tidy to simplify boolean conditional return statements

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

Patch by Richard<legalize@xmission.com>

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

9 years agoRemoved old FIXME - we do generate movddup for SSE3 and higher
Simon Pilgrim [Sat, 24 Oct 2015 20:15:43 +0000 (20:15 +0000)]
Removed old FIXME - we do generate movddup for SSE3 and higher

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

9 years ago[DAGCombiner] Tidy up ConstantFP commutation. NFCI
Simon Pilgrim [Sat, 24 Oct 2015 20:06:18 +0000 (20:06 +0000)]
[DAGCombiner] Tidy up ConstantFP commutation. NFCI

Move ConstantFP canonicalization of commutative instructions to start of 2-op node creation (matches integer) - simplifies constant folding code.

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

9 years agoUse all_of to simplify control flow. NFC.
Benjamin Kramer [Sat, 24 Oct 2015 19:30:37 +0000 (19:30 +0000)]
Use all_of to simplify control flow. NFC.

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

9 years agoAdd libuuid to required system libraries list for mingw.
Yaron Keren [Sat, 24 Oct 2015 19:27:28 +0000 (19:27 +0000)]
Add libuuid to required system libraries list for mingw.
This list is produced by llvm-config --system-libs to be used
by external programs using the llvm libraries, such as creduce.
In r250501 llvm/Support/Windows/Path.inc started to use the constant
FOLDERID_Profile from libuuid.

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

9 years agoUse find_if to simplify control flow. NFC.
Benjamin Kramer [Sat, 24 Oct 2015 19:03:15 +0000 (19:03 +0000)]
Use find_if to simplify control flow. NFC.

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

9 years ago[DAGCombiner] Generalize masking of constant rotates.
Simon Pilgrim [Sat, 24 Oct 2015 18:44:52 +0000 (18:44 +0000)]
[DAGCombiner] Generalize masking of constant rotates.

We don't need a mask of a rotation result to be a constant splat - any constant scalar/vector can be usefully folded.

Followup to D13851.

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

9 years agoCall the version of ConvertCostTableLookup that takes a statically sized array rather...
Craig Topper [Sat, 24 Oct 2015 18:40:22 +0000 (18:40 +0000)]
Call the version of ConvertCostTableLookup that takes a statically sized array rather than pointer and size. NFC

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

9 years agoX86ISelLowering: Support tail calls to/from callee pop functions
Hans Wennborg [Sat, 24 Oct 2015 16:47:10 +0000 (16:47 +0000)]
X86ISelLowering: Support tail calls to/from callee pop functions

This enables tail calls with thiscall, stdcall, vectorcall and
fastcall functions.

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

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

9 years agoFix unused variable warning. NFC.
Simon Pilgrim [Sat, 24 Oct 2015 13:41:45 +0000 (13:41 +0000)]
Fix unused variable warning. NFC.

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

9 years ago[X86][XOP] Add support for lowering vector rotations
Simon Pilgrim [Sat, 24 Oct 2015 13:17:26 +0000 (13:17 +0000)]
[X86][XOP] Add support for lowering vector rotations

This patch adds support for lowering to the XOP VPROT / VPROTI vector bit rotation instructions.

This has required changes to the DAGCombiner rotation pattern matching to support vector types - so far I've only changed it to support splat vectors, but generalising this further is feasible in the future.

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

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

9 years ago[TblGen] ArrayRefize CodeGenSchedule. No functionality change intended.
Benjamin Kramer [Sat, 24 Oct 2015 12:46:49 +0000 (12:46 +0000)]
[TblGen] ArrayRefize CodeGenSchedule. No functionality change intended.

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

9 years ago[TblGen] ArrayRefize TGParser. No functional change intended.
Benjamin Kramer [Sat, 24 Oct 2015 12:46:45 +0000 (12:46 +0000)]
[TblGen] ArrayRefize TGParser. No functional change intended.

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

9 years ago[BasicAliasAnalysis] Simplify expression, no functional change.
Benjamin Kramer [Sat, 24 Oct 2015 11:38:01 +0000 (11:38 +0000)]
[BasicAliasAnalysis] Simplify expression, no functional change.

(-1) - x + 1 is the same as -x.

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

9 years agoScalarReplAggregates.cpp: Try to appease clash of anonymous::SROA in modules build.
NAKAMURA Takumi [Sat, 24 Oct 2015 06:42:42 +0000 (06:42 +0000)]
ScalarReplAggregates.cpp: Try to appease clash of anonymous::SROA in modules build.

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

9 years agoExtract out getConstantRangeFromMetadata; NFC
Sanjoy Das [Sat, 24 Oct 2015 05:37:35 +0000 (05:37 +0000)]
Extract out getConstantRangeFromMetadata; NFC

The loop idiom creating a ConstantRange is repeated twice in the
codebase, time to give it a name and a home.

The loop is also repeated in `rangeMetadataExcludesValue`, but using
`getConstantRangeFromMetadata` there would not be an NFC -- the range
returned by `getConstantRangeFromMetadata` may contain a value that none
of the subranges did.

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

9 years agoFix whitespace issues in two places; NFC
Sanjoy Das [Sat, 24 Oct 2015 05:37:28 +0000 (05:37 +0000)]
Fix whitespace issues in two places; NFC

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

9 years agollvm/Transforms/Utils/LoopVersioning.h requires llvm/Analysis/LoopAccessAnalysis...
NAKAMURA Takumi [Sat, 24 Oct 2015 05:26:02 +0000 (05:26 +0000)]
llvm/Transforms/Utils/LoopVersioning.h requires llvm/Analysis/LoopAccessAnalysis.h for RuntimePointerChecking::PointerCheck.

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

9 years ago[libFuzzer] add -merge flag to merge corpora
Kostya Serebryany [Sat, 24 Oct 2015 01:16:40 +0000 (01:16 +0000)]
[libFuzzer] add -merge flag to merge corpora

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

9 years agoFix ADT/UniqueVector.h to resolve implicit dependency.
NAKAMURA Takumi [Sat, 24 Oct 2015 00:27:22 +0000 (00:27 +0000)]
Fix ADT/UniqueVector.h to resolve implicit dependency.

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

9 years agollvm/module.modulemap: AVR.def should be textual header.
NAKAMURA Takumi [Sat, 24 Oct 2015 00:25:18 +0000 (00:25 +0000)]
llvm/module.modulemap: AVR.def should be textual header.

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

9 years agoAMDGPU: Print modifiers when dumping AMDGPUOperand
Matt Arsenault [Sat, 24 Oct 2015 00:12:56 +0000 (00:12 +0000)]
AMDGPU: Print modifiers when dumping AMDGPUOperand

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

9 years ago[RS4GC] Rename stripDereferenceabilityInfo into stripNonValidAttributes.
Igor Laevsky [Fri, 23 Oct 2015 22:42:44 +0000 (22:42 +0000)]
[RS4GC] Rename stripDereferenceabilityInfo into stripNonValidAttributes.

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

9 years agoAdd a RAW mode to StringTableBuilder.
Rafael Espindola [Fri, 23 Oct 2015 21:48:05 +0000 (21:48 +0000)]
Add a RAW mode to StringTableBuilder.

In this mode it just tries to tail merge the strings without imposing any other
format constrains. It will not, for example, add a null byte between them.

Also add support for keeping a tentative size and offset if we decide to
not optimize after all.

This will be used shortly in lld for merging SHF_STRINGS sections.

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

9 years agoRevert rL251061 [SimplifyCFG] Extend SimplifyResume to handle phi of trivial landing...
Chen Li [Fri, 23 Oct 2015 21:13:01 +0000 (21:13 +0000)]
Revert rL251061 [SimplifyCFG] Extend SimplifyResume to handle phi of trivial landing pad.

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

9 years agoHandle non-constant shifts in computeKnownBits, and use computeKnownBits for constant...
Hal Finkel [Fri, 23 Oct 2015 20:37:08 +0000 (20:37 +0000)]
Handle non-constant shifts in computeKnownBits, and use computeKnownBits for constant folding in InstCombine/Simplify

First, the motivation: LLVM currently does not realize that:

  ((2072 >> (L == 0)) >> 7) & 1 == 0

where L is some arbitrary value. Whether you right-shift 2072 by 7 or by 8, the
lowest-order bit is always zero. There are obviously several ways to go about
fixing this, but the generic solution pursued in this patch is to teach
computeKnownBits something about shifts by a non-constant amount. Previously,
we would give up completely on these. Instead, in cases where we know something
about the low-order bits of the shift-amount operand, we can combine (and
together) the associated restrictions for all shift amounts consistent with
that knowledge. As a further generalization, I refactored all of the logic for
all three kinds of shifts to have this capability. This works well in the above
case, for example, because the dynamic shift amount can only be 0 or 1, and
thus we can say a lot about the known bits of the result.

This brings us to the second part of this change: Even when we know all of the
bits of a value via computeKnownBits, nothing used to constant-fold the result.
This introduces the necessary code into InstCombine and InstSimplify. I've
added it into both because:

  1. InstCombine won't automatically pick up the associated logic in
     InstSimplify (InstCombine uses InstSimplify, but not via the API that
     passes in the original instruction).

  2. Putting the logic in InstCombine allows the resulting simplifications to become
     part of the iterative worklist

  3. Putting the logic in InstSimplify allows the resulting simplifications to be
     used by everywhere else that calls SimplifyInstruction (inlining, unrolling,
     and many others).

And this requires a small change to our definition of an ephemeral value so
that we don't break the rest case from r246696 (where the icmp feeding the
@llvm.assume, is also feeding a br). Under the old definition, the icmp would
not be considered ephemeral (because it is used by the br), but this causes the
assume to remove itself (in addition to simplifying the branch structure), and
it seems more-useful to prevent that from happening.

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

9 years agoGVN: don't try to replace instruction with itself.
Tim Northover [Fri, 23 Oct 2015 20:30:02 +0000 (20:30 +0000)]
GVN: don't try to replace instruction with itself.

After some look-ahead PRE was added for GEPs, an instruction could end
up in the table of candidates before it was actually inspected. When
this happened the pass might decide it was the best candidate to
replace itself. This didn't go well.

Should fix PR25291

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

9 years agoFix the variable names to match the LLVM style.
Rafael Espindola [Fri, 23 Oct 2015 20:15:35 +0000 (20:15 +0000)]
Fix the variable names to match the LLVM style.

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

9 years ago[SCEV] Fix stylistic issue in MatchBinaryAddToConst; NFCI
Sanjoy Das [Fri, 23 Oct 2015 20:09:57 +0000 (20:09 +0000)]
[SCEV] Fix stylistic issue in MatchBinaryAddToConst; NFCI

Instead of checking `(FlagsPresent & ExpectedFlags) != 0`, check
`(FlagsPresent & ExpectedFlags) == ExpectedFlags`.  Right now they're
equivalent since `ExpectedFlags` can only be either `FlagNUW` or
`FlagNSW`, but if we ever pass in `ExpectedFlags` as `FlagNUW | FlagNSW`
then checking `(FlagsPresent & ExpectedFlags) != 0` would be wrong.

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

9 years ago[Inliner] Don't inline through callsites with operand bundles
Sanjoy Das [Fri, 23 Oct 2015 20:09:55 +0000 (20:09 +0000)]
[Inliner] Don't inline through callsites with operand bundles

Summary:
This change teaches the LLVM inliner to not inline through callsites
with unknown operand bundles.  Currently all operand bundles are
"unknown" operand bundles but in the near future we will add support for
inlining through some select kinds of operand bundles.

Reviewers: reames, chandlerc, majnemer

Subscribers: llvm-commits

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

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

9 years ago[CMake] Fixing dependency issue with parallel make when building with LLVM_OPTIMIZED_...
Chris Bieneman [Fri, 23 Oct 2015 19:48:17 +0000 (19:48 +0000)]
[CMake] Fixing dependency issue with parallel make when building with LLVM_OPTIMIZED_TABLEGEN.

Patch by Alex Wang

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