146769 Commits

Author SHA1 Message Date
Anna Thomas
6cde87723e [LVI] Add an LVI printer pass to capture test LVI cache after transformations
Summary:
Adding a printer pass for printing the LVI cache values after transformations
that use LVI.
This will help us in identifying cases where LVI
invariants are violated, or transforms that leave LVI in an incorrect state.
Right now, I have added two test cases to show that the printer pass is working.
I will be adding more test cases in a later change, once this change is
checked in upstream.

Reviewers: reames, dberlin, sanjoy, apilipenko

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D30790

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298542 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 19:27:12 +00:00
Luqman Aden
2b66aeed20 Preserve nonnull metadata on Loads through SROA & mem2reg.
Summary:
https://llvm.org/bugs/show_bug.cgi?id=31142 :

SROA was dropping the nonnull metadata on loads from allocas that got optimized out. This patch simply preserves nonnull metadata on loads through SROA and mem2reg.

Reviewers: chandlerc, efriedma

Reviewed By: efriedma

Subscribers: hfinkel, spatel, efriedma, arielb1, davide, llvm-commits

Differential Revision: https://reviews.llvm.org/D27114

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298540 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 19:16:39 +00:00
Peter Collingbourne
e53e585ce9 IPO: Const correctness for summaries passed into passes.
Pass const qualified summaries into importers and unqualified summaries into
exporters. This lets us const-qualify the summary argument to thinBackend.

Differential Revision: https://reviews.llvm.org/D31230

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298534 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 18:22:59 +00:00
Peter Collingbourne
49df148534 IR: Fix a race condition in type id clients of ModuleSummaryIndex.
Add a const version of the getTypeIdSummary accessor that avoids
mutating the TypeIdMap.

Differential Revision: https://reviews.llvm.org/D31226

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298531 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 18:04:39 +00:00
Adrian Prantl
fbf2dadfa5 Document the status quo of DIExpression semantics in LangRef.rst
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298528 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 18:01:01 +00:00
Adrian Prantl
9c7f94fba2 Rename helper functions in DwarfExpression to be less misleading (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298523 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 17:19:55 +00:00
Adrian Prantl
873f83571d Fix testcase on windows.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298521 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 17:15:03 +00:00
Sanjay Patel
cdd1430efb [InstCombine] canonicalize insertelement of scalar constant ahead of insertelement of variable
insertelement (insertelement X, Y, IdxC1), ScalarC, IdxC2 -->
insertelement (insertelement X, ScalarC, IdxC2), Y, IdxC1

As noted in the code comment and seen in the test changes, the motivation is that by pulling
constant insertion up, we may be able to constant fold some insertelement instructions.

Differential Revision: https://reviews.llvm.org/D31196



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298520 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 17:10:44 +00:00
Adrian Prantl
79ea811c41 Fix PR32298 by adding an early exit to getFrameIndexExprs().
Also add an assertion for the case that there are multiple FI
expressions with a DW_OP_LLVM_fragment; which should violate internal
constraints in DbgVariable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298518 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 16:50:16 +00:00
Zachary Turner
c5caccf493 Make the home_directory test a little more resilient.
It's possible (albeit strange) for $HOME to intentionally
point somewhere other than the user's home directory as
reported by the password database.  Our test shouldn't fail
in this case.  This patch updates the test to pull directly
from the password database before unsetting $HOME, rather
than comparing the return value of home_directory() to the
original value of the environment variable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298514 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 16:30:06 +00:00
Zachary Turner
2811bb8f72 Make home_directory look in the password database in addition to $HOME.
This is something of an edge case, but when the $HOME environment
variable is not set, we can still look in the password database
to get the current user's home directory.

Added a test for this by getting the value of $HOME, then unsetting
it, then calling home_directory() and verifying that it succeeds
and that the value is the same as what we originally read from
the environment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298513 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 15:24:59 +00:00
Artyom Skrobov
677bddb49c [ARM] t2_so_imm_neg had a subtle bug in the conversion, and could trigger UB by negating (int)-2147483648. By pure luck, none of the pre-existing tests triggered this; so I'm adding one.
Summary: Thanks to Vitaly Buka for helping catch this.

Reviewers: rengolin, jmolloy, efriedma, vitalybuka

Subscribers: llvm-commits, aemerson

Differential Revision: https://reviews.llvm.org/D31242

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298512 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 15:09:30 +00:00
Rafael Espindola
30582488b0 Add default typo to .tbss.*
This matches gas behavior and is part of pr31888.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298508 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 14:04:19 +00:00
Rafael Espindola
e67048abe7 Set the default type for .bss.foo.
This matches gas and is part of pr31888.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298506 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 13:57:16 +00:00
Rafael Espindola
354d23526f Produce INIT_ARRAY for sections named .init_array.*
These sections are merged together by the linker, so they should have
the same time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298505 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 13:35:41 +00:00
Dmitry Preobrazhensky
6176e441fd [AMDGPU][MC] Fix for Bug 28204 + LIT tests
Fixed v_mad_i64_i32/u64_u32 encoding

Reviewers: artem.tamazov

Differential Revision: https://reviews.llvm.org/D30828

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298502 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 13:31:01 +00:00
Serge Pavlov
95702085d5 [CMake] Use variable interpolation instead of string concatenation
String concatenation used in r298336 allowed to get rid of extra spaces
but also resulted in lost delimiter spaces, so use previous method.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298498 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 12:06:11 +00:00
Simon Pilgrim
f7a3695ab5 [X86] Add multiply by constant tests (PR28513)
As discussed on PR28513, add tests for constant multiplication by constants between 1 to 32

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298497 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 12:03:56 +00:00
Evgeny Astigeevich
ef253e2f6e r286814 resulted that CallPenalty can be subtracted twice:
- First time, during calculation of the cost in InlineCost.cpp
- Second time, during calculation of the cost in Inliner.cpp

This patches fixes this.

Differential Revision: https://reviews.llvm.org/D31137


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298496 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 12:01:57 +00:00
Simon Pilgrim
490efdea22 [X86] Remove unnecessary duplicate code (PR30649). NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298495 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 11:23:49 +00:00
Max Kazantsev
84c3daf081 Revert "[ScalarEvolution] Predicate implication from operations"
This reverts commit rL298481

Fails clang-with-lto-ubuntu build.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298489 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 07:50:33 +00:00
Craig Topper
f448321cdd [ValueTracking] Make sure we keep range metadata information when calculating known bits for calls to bitreverse intrinsic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298488 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 07:22:49 +00:00
Craig Topper
5b64d78c22 [ValueTracking] use setLowBits/setHighBits/setBitsFrom to replace |= getHighBits/getLowBits. NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298486 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 06:19:37 +00:00
Craig Topper
9121f7ee15 [X86] Remove an unused function from release builds. Reported by gccs unused function warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298485 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 06:07:58 +00:00
Jonas Paulsson
23d3b2f777 [SystemZ] Don't drop any operands in expandZExtPseudo()
Make sure that any operands, e.g. of an implicit def of a super reg is
transferred to the new instruction.

Review: Ulrich Weigand

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298484 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 06:03:32 +00:00
Vitaly Buka
122028fe3a Revert "[ARM] Recommit the glueless lowering of addc/adde in Thumb1, including the amended (no UB anymore) fix for adding/subtracting -2147483648."
Fails check-llvm with ubsan

This reverts commit r298417.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298482 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 05:07:44 +00:00
Max Kazantsev
767f8ddf17 [ScalarEvolution] Predicate implication from operations
This patch allows SCEV predicate analysis to prove implication of some expression predicates
from context predicates related to arguments of those expressions.
It introduces three new rules:

For addition:
  (A >X && B >= 0) || (B >= 0 && A > X) ===> (A + B) > X.

For division:
  (A > X) && (0 < B <= X + 1) ===> (A / B > 0).
  (A > X) && (-B <= X < 0) ===> (A / B >= 0).

Using these rules, SCEV is able to prove facts like "if X > 1 then X / 2 > 0".
They can also be combined with the same context, to prove more complex expressions like
"if X > 1 then X/2 + 1 > 1".

Diffirential Revision: https://reviews.llvm.org/D30887

Reviewed by: sanjoy



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298481 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 04:48:46 +00:00
Brian Gesiak
81e6d00cf5 lit: remove python2-isms
Summary:
`assert.assertItemEqual` went away in Python 3. Seeing how lists
are ordered, comparing a list against each other should work just
as well.

Patch by @jbergstroem (Johan Bergström).

Reviewers: modocache, gparker42

Reviewed By: modocache

Differential Revision: https://reviews.llvm.org/D31229



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298479 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 04:23:01 +00:00
Craig Topper
2612791ba8 [InstCombine] Teach SimplifyDemandedUseBits to shrink Constants on the left side of subtracts
Summary: Subtracts can have constants on the left side, but we don't shrink them based on demanded bits. This patch fixes that to match the right hand side.

Reviewers: davide, majnemer, spatel, sanjoy, hfinkel

Reviewed By: spatel

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D31119

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298478 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 04:03:53 +00:00
Reid Kleckner
3c488ca5a4 [codeview] Use separate records for LF_SUBSTR_LIST and LF_ARGLIST
They are structurally the same, but now we need to distinguish them
because one record lives in the IPI stream and the other lives in TPI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298474 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 01:37:38 +00:00
Aditya Nandakumar
1b722a40ce [GlobalISel]: Create VREGs for ConstantInt args
This patch changes the behavior of IRTranslating intrinsics where we
now create VREG + G_CONSTANT for ConstantInt values. We already do this
for FloatingPoint values. This makes it easier for the backends to
select code and it won't have to de-duplicate creation+selection of
constants.

Reviewed by: ab

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298473 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 01:16:39 +00:00
Adrian Prantl
a284ce24c9 Don't compose DWARF expressions with multiple subregisters.
If a register location can only be described by a complex expression
(i.e., multiple subregisters) it doesn't safely compose with another
complex expression. For example, it is not possible to apply a
DW_OP_deref operation to multiple DW_OP_pieces.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298472 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 01:16:01 +00:00
Adrian Prantl
5b1a3cb67c DwarfExpression: Defer emitting DWARF register operations
until the rest of the expression is known.

This is still an NFC refactoring in preparation of a subsequent bugfix.

This reapplies r298388 with a bugfix for non-physical frame registers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298471 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 01:15:57 +00:00
Adam Nemet
5fead02594 Make test more robust
Set the flags on FAdd locally rather than assuming nothing will change it from
way earlier in the test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298462 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 23:50:52 +00:00
Zachary Turner
d10b8de6de Resubmit "Improve StringMap iterator support."
The issue was trying to advance past the end of the iterator
when computing the end() iterator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298461 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 23:45:03 +00:00
Ahmed Bougacha
a4a05c5804 [GlobalISel] Update DBG_VALUEs referencing DCE'd instructions.
Quentin points out that r298358 would cause us to emit different code
with debug info.  That's a big no-no; also erase the instructions that
only live thanks to DBG_VALUE users.

Adrian explained how this is an existing problem and an OK thing to do:
clang has allocas for all variables so shouldn't be affected at -O0, but
swift uses a bit of inlineasm to explicitly keep values live for the
purpose of debug info quality.  I'm not sure there is a better scheme.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298460 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 23:42:54 +00:00
Ahmed Bougacha
de65337f18 [GlobalISel] Don't translate br to layout successor.
MI can represent fallthrough to layout successor blocks, and our
post-isel representation uses that extensively.

We might as well use it too, to avoid translating and carrying along
unnecessary branches.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298459 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 23:42:50 +00:00
Craig Topper
a28580d8ef [IR] Remove validAlignment and validPointer methods DataLayout as they aren't used.
I don't think validAlignment has been used since r34358 in 2007. I think validPointer was copied from validAlignment some time later, but it definitely wasn't used in the first commit that contained it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298458 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 23:04:23 +00:00
Matt Arsenault
956477d1ca AMDGPU: Remove hasSideEffects from SI_RETURN_TO_EPILOG
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298454 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 22:28:48 +00:00
Tim Northover
9be3bb922a GlobalISel: respect BooleanContents when extending i1.
The world isn't just x86 & ARM, some targets need to store -1 into the byte
when legalizing a bool store.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298453 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 22:22:05 +00:00
Matt Arsenault
dc55587b7f AMDGPU: Rename SI_RETURN
This is used for a specific type of return to a shader part's
epilog code. Rename to try avoiding confusion from a true
call's return.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298452 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 22:18:10 +00:00
Matthias Braun
9c890fc5b3 SplitKit: Fix subreg copy related problems
Fix two problems related to r298025:
- SplitKit would create duplicate VNIs in some cases leading to crashs
  when hoisting copies.
- VirtRegMap could fail expanding copies at the beginning of a basic
  block.

This fixes http://llvm.org/PR32353

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298448 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 21:58:08 +00:00
Matt Arsenault
d706d030af AMDGPU: Mark all unspecified CC functions in tests as amdgpu_kernel
Currently the default C calling convention functions are treated
the same as compute kernels. Make this explicit so the default
calling convention can be changed to a non-kernel.

Converted with perl -pi -e 's/define void/define amdgpu_kernel void/'
on the relevant test directories (and undoing in one place that actually
wanted a non-kernel).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298444 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 21:39:51 +00:00
Zachary Turner
123d0b8e82 Revert "Improve StringMap iterator support."
This is causing crashes in clang, so reverting until the problem
is figured out.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298440 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 21:23:57 +00:00
Tim Northover
07435f1d78 GlobalISel: widen booleans by zero-extending to a byte.
A bool is represented by a single byte, which the ARM ABI requires to be either
0 or 1. So we cannot use G_ANYEXT when legalizing the type.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298439 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 21:12:04 +00:00
Zachary Turner
53bbec9603 Fix clang errors caused by StringMap iterator changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298437 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 20:41:51 +00:00
Zachary Turner
26bdd1d112 Improve StringMap iterator support.
StringMap's iterators did not support LLVM's
iterator_facade_base, which made it unusable in various
STL algorithms or with some of our range adapters.
This patch makes both StringMapConstIterator as well as
StringMapIterator support iterator_facade_base.

With this in place, it is easy to make an iterator adapter
that iterates over only keys, and whose value_type is
StringRef.  So I add StringMapKeyIterator as well, and
provide the method StringMap::keys() that returns a
range that can be iterated.

Differential Revision: https://reviews.llvm.org/D31171

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298436 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 20:27:36 +00:00
Zachary Turner
bf2f3949e7 Remove eol-style:native from StringMap.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298435 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 20:21:56 +00:00
Sanjay Patel
0be9db9ff3 [InstCombine] regenerate checks; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298432 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 20:14:38 +00:00
George Burgess IV
3479ed63a6 Let llvm.objectsize be conservative with null pointers
This adds a parameter to @llvm.objectsize that makes it return
conservative values if it's given null.

This fixes PR23277.

Differential Revision: https://reviews.llvm.org/D28494


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298430 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 20:08:59 +00:00