Commit Graph

7817 Commits

Author SHA1 Message Date
Adam Nemet
2b2a8f145d [LoopDataPrefetch] Add optimization remark
With -Rpass=loop-data-prefetch, show the memory access that got
prefetched.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268578 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-05 00:08:15 +00:00
Vitaly Buka
6e64fd8d92 Revert "[SimplifyCFG] propagate branch metadata when creating select"
MemorySanitizer: use-of-uninitialized-value
0x4910e47 in count /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/include/llvm/Support/MathExtras.h:159:12
0x4910e47 in countLeadingZeros<unsigned long> /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/include/llvm/Support/MathExtras.h:183
0x4910e47 in FitWeights /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/Transforms/Utils/SimplifyCFG.cpp:855
0x4910e47 in SimplifyCondBranchToCondBranch /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/Transforms/Utils/SimplifyCFG.cpp:2895

This reverts commit 609f4dd4bf.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268577 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-04 23:59:33 +00:00
Balaram Makam
94ee5ea0aa "Reapply r268521 "[InstCombine] Canonicalize icmp instructions based on dominating conditions.""
This reapplies commit r268521, that was reverted in r268530 due to a test failure in select-implied.ll
Modified the test case to reflect the new change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268557 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-04 21:32:14 +00:00
Sanjay Patel
609f4dd4bf [SimplifyCFG] propagate branch metadata when creating select
Unlike earlier similar fixes, we need to recalculate the branch weights
in this case.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268550 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-04 20:48:24 +00:00
Hal Finkel
5813ee1a22 [ConstantFold] Don't try to strip fp -> int bitcasts to simplify icmps
ConstantFold has logic to take icmp (bitcast x to y), null and strip the
bitcast. This makes sense in general, but not if x has floating-point type. In
this case, we'd need a fcmp, not an icmp, and the code will assert. We normally
don't see this situation because we constant fold fp -> int bitcasts, however,
we'll see it for bitcasts of ppc_fp128 -> i128. This is because that bitcast is
Endian-dependent, and as a result, we don't simplify it in ConstantFold (we
could, but no one has yet added the necessary logic). Regardless, ConstantFold
should not depend on that canonicalization for correctness.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268534 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-04 19:37:08 +00:00
Balaram Makam
30f97f1d5c Revert "[InstCombine] Canonicalize icmp instructions based on dominating conditions."
This reverts commit 573a40f79b35cf3e71db331bb00f6a84f03b835d.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268530 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-04 18:37:35 +00:00
Marianne Mailhot-Sarrasin
51b20e8812 Adding test cases showing the behavior of LoopUnrollPass according to optnone and optsize attributes
The unroll pass was disabled by clang in /Os. Those new test cases shows that the pass will behave correctly even if it is not fully disabled. This patch is related in some way to the clang commit (http://reviews.llvm.org/D19827), which re-enables the pass in /Os.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268524 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-04 17:45:40 +00:00
Balaram Makam
decf72be2d [InstCombine] Canonicalize icmp instructions based on dominating conditions.
Summary:
    This patch canonicalizes conditions based on the constant range information
    of the dominating branch condition.
    For example:

      %cmp = icmp slt i64 %a, 0
      br i1 %cmp, label %land.lhs.true, label %lor.rhs
      lor.rhs:
        %cmp2 = icmp sgt i64 %a, 0

    Would now be canonicalized into:

      %cmp = icmp slt i64 %a, 0
      br i1 %cmp, label %land.lhs.true, label %lor.rhs
      lor.rhs:
        %cmp2 = icmp ne i64 %a, 0

Reviewers: mcrosier, gberry, t.p.northover, llvm-commits, reames, hfinkel, sanjoy, majnemer

Subscribers: MatzeB, majnemer, mcrosier

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268521 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-04 17:34:20 +00:00
Hans Wennborg
2946daa8af [SimplifyCFG] isSafeToSpeculateStore now ignores debug info
This patch fixes PR27615.

@llvm.dbg.value instructions no longer count towards the maximum number of
instructions to look back at in the instruction list when searching for a
store instruction. This should make the output consistent between debug and
non-debug build.

Patch by Henric Karlsson <henric.karlsson@ericsson.com>!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268512 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-04 15:40:57 +00:00
Igor Laevsky
8a04253827 [RS4GC] Use SetVector/MapVector instead of DenseSet/DenseMap to guarantee stable ordering
Goal of this change is to guarantee stable ordering of the statepoint arguments and other 
newly inserted values such as gc.relocates. Previously we had explicit sorting in a couple
of places. However for unnamed values ordering was partial and overall we didn't have any 
strong invariant regarding it. This change switches all data structures to use SetVector's
and MapVector's which provide possibility for deterministic iteration over them.
Explicit sorting is now redundant and was removed.

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




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268502 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-04 14:55:36 +00:00
David Majnemer
c454f3e111 [ConstantFolding, ValueTracking] Fold constants involving bitcasts of ConstantVector
We assumed that ConstantVectors would be rather uninteresting from the
perspective of analysis.  However, this is not the case due to a quirk
of how LLVM handles vectors of i1.  Vectors of i1 are not
ConstantDataVectors like vectors of i8, i16, i32 or i64 because i1's
SizeInBits differs from it's StoreSizeInBytes.  This leads to it being
categorized as a ConstantVector instead of a ConstantDataVector.

Instead, treat ConstantVector more uniformly.

This fixes PR27591.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268479 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-04 06:13:33 +00:00
David Majnemer
fea3ecb60c [GlobalDCE, Misc] Don't remove functions referenced by ifuncs
We forgot to consider the target of ifuncs when considering if a
function was alive or dead.

N.B. Also update a few auxiliary tools like bugpoint and
verify-uselistorder.

This fixes PR27593.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268468 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-04 00:20:48 +00:00
Justin Bogner
0b059c126c PM: Port LoopRotation to the new loop pass manager
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268452 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 22:02:31 +00:00
Justin Bogner
cc5bcb5917 PM: Port LoopSimplifyCFG to the new pass manager
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268446 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 21:47:32 +00:00
Sanjoy Das
5fb55f614d [RS4GC] Add a test case around calling conventions; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268436 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 20:58:10 +00:00
Davide Italiano
82cad6f228 [IPO/GlobalDCE] Port to the new pass manager.
Differential Revision:  http://reviews.llvm.org/D19782

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268425 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 19:39:15 +00:00
Jack Liu
8185ccbb4a [SROA] Function canConvertValue needs to check whether both NewTy and OldTy pointers are
pointing to the same addr space. This can prevent SROA from creating a bitcast
between pointers with different addr spaces.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268424 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 19:30:48 +00:00
Jack Liu
9fd5cab227 Revert 268409 due to missing comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268421 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 19:15:02 +00:00
Jack Liu
4ddc88ec41 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268409 91177308-0d34-0410-b5e6-96231b3b80d8 2016-05-03 18:01:43 +00:00
Sanjoy Das
2845c75fa6 [LICM] Kill SCEV loop dispositions if needed
SCEV caches whether SCEV expressions are loop invariant, variant or
computable.  LICM breaks this cache, almost by definition; so clear the
SCEV disposition cache if LICM changed anything.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268408 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 17:50:11 +00:00
Sanjoy Das
26fc3018c2 Use all_of instead of a raw loop; NFC
Added some tests despite being NFC, since it looks like nothing was
exercising the "all incoming values to exit PHIs are same" logic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268407 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 17:50:06 +00:00
Sanjoy Das
045a03d9a7 [LoopDeletion] Clear SCEV loop dispositions
`Loop::makeLoopInvariant` can hoist instructions out of loops, so loop
dispositions for the loop it operated on may need to be cleared.  We can
be smarter here (especially around how `forgetLoopDispositions` is
implemented), but let's be correct first.

Fixes PR27570.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268406 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 17:50:02 +00:00
Anna Thomas
bf6a9dfb62 Fold compares irrespective of whether allocation can be elided
Summary
When a non-escaping pointer is compared to a global value, the
comparison can be folded even if the corresponding malloc/allocation
call cannot be elided.
We need to make sure the global value is not null, since comparisons to
null cannot be folded.

In future, we should also handle cases when the the comparison
instruction dominates the pointer escape.

Reviewers: sanjoy
Subscribers s.egerton, llvm-commits

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268390 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 14:58:21 +00:00
Kristof Beyls
e3e438a4cd Mark that SpeculativeExecution preserves Globals Alias Analysis.
A few benchmarks with lots of accesses to global variables in the hot
loops regressed a lot since r266399, which added the
SpeculativeExecution pass to the default pipeline. The problem is that
this pass doesn't mark Globals Alias Analysis as preserved. Globals
Alias Analysis is computed in a module pass, whereas
SpeculativeExecution is a function pass, and a lot of passes dependent
on the Globals Alias Analysis to optimize these benchmarks are also
function passes. As such, the Globals Alias Analysis information cannot
be recomputed between SpeculativeExecution and the following function
passes needing that information.

SpeculativeExecution doesn't invalidate Globals Alias Analysis, so mark
it as such to fix those performance regressions.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268370 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 08:33:26 +00:00
Jack Liu
2d54216d9b test commit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268358 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 04:06:24 +00:00
David Majnemer
67d4f302ed [LoopUnroll] Unroll loops which have exit blocks to EH pads
We were overly cautious in our analysis of loops which have invokes
which unwind to EH pads.  The loop unroll transform is safe because it
only clones blocks in the loop body, it does not try to split critical
edges involving EH pads.  Instead, move the necessary safety check to
LoopUnswitch.

N.B. The safety check for loop unswitch is covered by an existing test
which fails without it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268357 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 03:57:40 +00:00
Mehdi Amini
dd2d6cfee4 ThinLTO: do not import function whose linkage prevents inlining.
There is not point in importing a "weak" or a "linkonce" function
since we won't be able to inline it anyway.
We already had a targeted check for WeakAny, this is using the
same check on GlobalValue as the inline, i.e.
isMayBeOverriddenLinkage()

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268341 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 00:27:28 +00:00
Mehdi Amini
2ef976219b Revert "ThinLTO: do not import function whose linkage prevents inlining."
This reverts commit r268315, the tests are not passing.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268317 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-02 22:26:04 +00:00
Mehdi Amini
e1cf918848 ThinLTO: do not import function whose linkage prevents inlining.
There is not point in importing a "weak" or a "linkonce" function
since we won't be able to inline it anyway.
We already had a targeted check for WeakAny, this is using the
same check on GlobalValue as the inline, i.e.
isMayBeOverriddenLinkage()

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268315 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-02 22:11:27 +00:00
Reid Kleckner
0e77da267e Revert "[SimplifyCFG] Extend TryToSimplifyUncondBranchFromEmptyBlock for empty block including lifetime intrinsics"
This reverts commit r268254.

This change causes assertion failures while building Chromium. Reduced
test case coming soon.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268288 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-02 19:43:22 +00:00
Hans Wennborg
0c15a0b738 [SimplifyCFG] Extend TryToSimplifyUncondBranchFromEmptyBlock for empty block including lifetime intrinsics
Make it possible that TryToSimplifyUncondBranchFromEmptyBlock merges empty
basic block including lifetime intrinsics as well as phi nodes and
unconditional branch into its successor or predecessor(s).

If successor of empty block has single predecessor, all contents including
lifetime intrinsics are sinked into the successor. Otherwise, they are
hoisted into its predecessor(s) and then merged into the predecessor(s).

Patch by Josh Yoon <josh.yoon@samsung.com>!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268254 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-02 17:22:54 +00:00
Chad Rosier
83094c44c4 Remove extra whitespace. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268248 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-02 16:45:00 +00:00
Sanjay Patel
a1adc36474 remove blank lines
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268246 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-02 15:49:09 +00:00
Sanjay Patel
e3b561ea48 [InstCombine] regenerate checks
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268245 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-02 15:32:10 +00:00
Sanjay Patel
5d85cb4598 [InstCombine] regenerate checks
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268244 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-02 15:25:49 +00:00
Sanjay Patel
1893130a0c [InstCombine] regenerate checks
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268242 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-02 15:21:41 +00:00
Sanjay Patel
b792c80820 [InstCombine] regenerate checks
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268241 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-02 15:18:13 +00:00
Sanjay Patel
dd8491a614 [InstCombine] regenerate checks
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268239 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-02 15:06:55 +00:00
Sanjay Patel
2bce87c412 [InstCombine] regenerate checks
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268232 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-02 14:21:55 +00:00
Davide Italiano
f974ccff67 [GlobalDCE] Modernize. Use FileCheck instead of grep.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268207 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-01 22:51:14 +00:00
Simon Pilgrim
ef96d1f545 [InstCombine][SSE] Added support to VPERMD/VPERMPS to shuffle combine to accept UNDEF elements.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268206 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-01 20:43:02 +00:00
Simon Pilgrim
ae8a509ec4 Dropped FIXME comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268205 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-01 20:33:25 +00:00
Simon Pilgrim
c244765b2c [InstCombine][SSE] Added support to VPERMILVAR to shuffle combine to accept UNDEF elements.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268204 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-01 20:22:42 +00:00
Simon Pilgrim
6f6c7b0654 [InstCombine][AVX] Fixed PERMILVAR identity tests and added additional decode tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268203 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-01 20:06:47 +00:00
Simon Pilgrim
a1c0cfe5e4 [InstCombine][SSE] Added support to PSHUFB to shuffle combine to accept UNDEF elements.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268202 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-01 19:26:21 +00:00
Simon Pilgrim
8d33576d14 [InstCombine][SSE] Regenerate MOVSX/MOVZX tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268201 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-01 18:28:45 +00:00
Simon Pilgrim
95730ae9bd [InstCombine][AVX2] Combine VPERMD/VPERMPS intrinsics with constant masks to shufflevector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268199 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-01 16:41:22 +00:00
Simon Pilgrim
585ee3d03c [InstCombine][AVX2] Added VPERMD/VPERMPS shuffle combining placeholder tests.
For future support for VPERMD/VPERMPS to generic shuffles combines

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268166 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-30 20:41:52 +00:00
Simon Pilgrim
79d72aac7a [InstCombine][AVX] Split off VPERMILVAR tests and added additional tests for UNDEF mask elements
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268159 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-30 07:32:19 +00:00
Sanjoy Das
793e61921c [LowerGuardIntrinsics] Keep track of !make.implicit metadata
If a guard call being lowered by LowerGuardIntrinsics has the
`!make.implicit` metadata attached, then reattach the metadata to the
branch in the resulting expanded form of the intrinsic.  This allows us
to implement null checks as guards and still get the benefit of implicit
null checks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268148 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-30 00:55:59 +00:00