15020 Commits

Author SHA1 Message Date
Sanjay Patel
576f0d9e3e [SimplifyCFG] propagate branch metadata when creating select (retry r268550 with possible fix)
Retrying r268550 which was reverted at r268577 due a memory sanitizer failure.
I have not been able to reproduce that failure, but I've taken a guess at fixing
the problem in this version of the patch and will watch for another failure.

Original commit message:
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@268751 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-06 17:07:47 +00:00
Chad Rosier
cd0223f1eb [SimplifyCFG] Prefer a simplification based on a dominating condition.
Rather than merge two branches with a common destination.
Differential Revision: http://reviews.llvm.org/D19743

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268735 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-06 14:25:14 +00:00
Ryan Govostes
ffe6f6b6be Fix whitespace and line wrapping. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268725 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-06 11:22:11 +00:00
Ryan Govostes
7cf5d6815b [asan] add option to set shadow mapping offset
Allowing overriding the default ASAN shadow mapping offset with the
-asan-shadow-offset option, and allow zero to be specified for both offset and
scale.

Patch by Aaron Carroll <aaronc@apple.com>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268724 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-06 10:25:22 +00:00
Mehdi Amini
d4ecd0d79c ThinLTO: fix assertion and refactor check for hidden use from inline ASM in a helper function
This test was crashing, and currently it breaks bootstrapping clang with debuginfo

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268715 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-06 08:25:33 +00:00
Xinliang David Li
ea2fb7d1dd [PM] port IR based PGO prof-gen pass to new pass manager
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268710 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-06 05:49:19 +00:00
Philip Reames
b2a9448a0b [EarlyCSE] Rename a variable for clarity [NFC]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268701 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-06 01:13:58 +00:00
Davide Italiano
2d1483c124 [PM] Port Interprocedural SCCP to the new pass manager.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268684 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-05 21:05:36 +00:00
Dehao Chen
d025c697a5 Revert http://reviews.llvm.org/D19926 as it breaks tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268681 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-05 20:47:53 +00:00
Dehao Chen
8200288f55 Simplify CFG before assigning discriminator.
Summary: We need to clean up CFG before assigning discriminator to minimize the impact of optimization on debug info.

Reviewers: davidxl, dblaikie, dnovillo

Subscribers: dnovillo, danielcdh, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268675 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-05 20:18:49 +00:00
Marcin Koscielnicki
c16ab2d841 [MSan] [MIPS64] Fix vararg helper for >1 fixed argument.
This fixes http://llvm.org/PR27646 on Mips64.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268673 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-05 20:13:17 +00:00
Vitaly Buka
eb80fa1253 Revert "[ThinLTO] Emit individual index files for distributed backends"
MemorySanitizer: use-of-uninitialized-value in lib/Bitcode/Writer/BitcodeWriter.cpp:364:70
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/12544/steps/check-llvm%20msan/logs/stdio

This reverts commit 0c4a898ea550699d1b2f4fe3767251c8f9a48d52.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268660 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-05 18:31:00 +00:00
Chad Rosier
2677f2feeb Remove dead include. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268655 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-05 17:55:51 +00:00
Chad Rosier
f1ccfb792f Remove dead include. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268654 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-05 17:53:43 +00:00
Silviu Baranga
b8ed2a0b3b Fix unused variable warning after r268632
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268634 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-05 15:27:57 +00:00
Silviu Baranga
debb790c77 [LV] Identify more induction PHIs by coercing expressions to AddRecExprs
Summary:
Some PHIs can have expressions that are not AddRecExprs due to the presence
of sext/zext instructions. In order to prevent the Loop Vectorizer from
bailing out when encountering these PHIs, we now coerce the SCEV
expressions to AddRecExprs using SCEV predicates (when possible).

We only do this when the alternative would be to not vectorize.

Reviewers: mzolotukhin, anemet

Subscribers: mssimpso, sanjoy, mzolotukhin, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268633 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-05 15:20:39 +00:00
Silviu Baranga
e1eac033b6 [LV] Refactor the validation of PHI inductions. NFC
This moves the validation of PHI inductions into a
separate method, making it easier to reuse this
logic.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268632 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-05 15:14:01 +00:00
Teresa Johnson
0c4a898ea5 [ThinLTO] Emit individual index files for distributed backends
Summary:
When launching ThinLTO backends in a distributed build (currently
supported in gold via the thinlto-index-only plugin option), emit
an individual index file for each backend process as described here:
http://lists.llvm.org/pipermail/llvm-dev/2016-April/098272.html

The individual index file encodes the summary and module information
required for implementing the importing/exporting decisions made
for a given module in the thin link step.
This is in place of the current mechanism that uses the combined index
to make importing decisions in each back end independently. It is an
enabler for doing global summary based optimizations in the thin link
step (which will be recorded in the individual index files), and reduces
the size of the index that must be sent to each backend process, and
the amount of work to scan it in the backends.

Rather than create entirely new ModuleSummaryIndex structures (and all
the included unique_ptrs) for each backend index file, a map is created
to record all of the GUID and summary pointers needed for a particular
index file. The IndexBitcodeWriter walks this map instead of the full
index (hiding the details of managing the appropriate summary iteration
in a new iterator subclass). This is more efficient than walking the
entire combined index and filtering out just the needed summaries during
each backend bitcode index write.

Depends on D19481.

Reviewers: joker.eph

Subscribers: llvm-commits, joker.eph

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268627 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-05 13:44:56 +00:00
Davide Italiano
e44aed739e [PM] Port EliminateAvailableExternally pass to the new pass manager.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268599 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-05 02:37:32 +00:00
Ryan Govostes
8c98d34395 Revert "[asan] add option to set shadow mapping offset"
This reverts commit ba89768f97b1d4326acb5e33c14eb23a05c7bea7.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268588 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-05 01:27:04 +00:00
Ryan Govostes
ba89768f97 [asan] add option to set shadow mapping offset
Allowing overriding the default ASAN shadow mapping offset with the
-asan-shadow-offset option, and allow zero to be specified for both offset and
scale.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268586 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-05 01:14:39 +00:00
Dehao Chen
8b3e014d45 clang-format some files in preparation of coming patch reviews.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268583 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-05 00:54:54 +00:00
Davide Italiano
0a517713cd [PM] Port ConstantMerge to the new pass manager.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268582 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-05 00:51:09 +00:00
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 609f4dd4bf3bc735c8c047a4d4b0a8e9e4d202e2.

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
Davide Italiano
252a6d1f04 Revert "[SCCP] Throw away dead code. NFC."
This reverts commit r268568, as it broke the bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268570 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-04 23:27:13 +00:00
Davide Italiano
9c9f877ca2 [SCCP] Throw away dead code. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268568 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-04 23:05:59 +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
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
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
Chad Rosier
04d8cf0622 Use a uniform name for the load combine pass. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268507 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-04 15:19:02 +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
Davide Italiano
fbaff661ff [IPO/ConstantMerge] Convert to static function, to facilitate transition to the new PM.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268476 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-04 03:21:20 +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
Andrew Kaylor
7b7e9c726b Add opt-bisect support to additional passes that can be skipped
Differential Revision: http://reviews.llvm.org/D19882



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268457 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 22:32:30 +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
Davide Italiano
1e1b4aed49 [IPO/ConstantMerge] Garbage collect dead code. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268442 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 21:30:10 +00:00
Davide Italiano
692cb17dfd [IPO/IPCP] Convert to use static functions. NFC.
In preparation for porting this pass to the new PM.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268429 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 20:08:24 +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
Vedant Kumar
707e782733 [ProfileData] Add error codes for compression failures
Be more specific in describing compression failures. Also, check for
this kind of error in emitNameData().

This is part of a series of patches to transition ProfileData over to
the stricter Error/Expected interface.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268400 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 16:53:17 +00:00
Mehdi Amini
6c3ac407d3 Move "Eliminate Available Externally" immediately after the inliner
This pass is supposed to reduce the size of the IR for compile time
purpose. We should run it ASAP, except when we prepare for LTO or
ThinLTO, and we want to keep them available for link-time inline.

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268394 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 15:46:00 +00:00