Commit Graph

147638 Commits

Author SHA1 Message Date
Tobias Edler von Koch
7f80f1bbf5 LTO: Pass SF_Executable flag through to InputFile::Symbol
Summary:
The linker needs to be able to determine whether a symbol is text or data to
handle the case of a common being overridden by a strong definition in an
archive. If the archive contains a text member of the same name as the common,
that function is discarded. However, if the archive contains a data member of
the same name, that strong definition overrides the common. This is a behavior
of ld.bfd, which the Qualcomm linker also supports in LTO.

Here's a test case to illustrate:

####

cat > 1.c << \!
int blah;
!

cat > 2.c << \!
int blah() {
  return 0;
}
!

cat > 3.c << \!
int blah = 20;
!

clang -c 1.c
clang -c 2.c
clang -c 3.c

ar cr lib.a 2.o 3.o
ld 1.o lib.a -t

####

The correct output is:

1.o
(lib.a)3.o

Thanks to Shankar Easwaran and Hemant Kulkarni for the test case!

Reviewers: mehdi_amini, rafael, pcc, davide

Reviewed By: pcc

Subscribers: davide, llvm-commits, inglorion

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300205 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 16:24:14 +00:00
Krzysztof Parzyszek
d8dec6c86f [Hexagon] Unxfail passing tests
r300198 fixed a problem that caused two tests to be xfailed. Unxfail
these tests now, since they are passing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300203 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 16:05:35 +00:00
Sanjay Patel
9defcc4205 [InstCombine] fix assert to not always be true
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300202 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 16:05:01 +00:00
Sanjay Patel
718498681f [InstCombine] add/move tests for or-of-icmps; NFC
If we had these tests, the bug caused by https://reviews.llvm.org/rL299851 would have been caught sooner.
There's also an assert in the code that should have caught that bug, but the assert line itself has a bug.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300201 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 15:46:39 +00:00
Geoff Berry
0f154b0e36 Re-apply "[GVNHoist] Move GVNHoist to function simplification part of pipeline."
This reverts commit r296872 now that PR32153 has been fixed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300200 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 15:36:25 +00:00
Krzysztof Parzyszek
7fa51d159a [Hexagon] Implement HexagonTargetLowering::CanLowerReturn
Patch by Michael Wu.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300199 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 15:05:51 +00:00
Krzysztof Parzyszek
db734f0a3d [Hexagon] Fix "LowerFormalArguments emitted a value with the wrong type!" assertion
Patch by Michael Wu.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300198 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 15:00:18 +00:00
Serge Pavlov
cf2d2611cf Use methods to access data stored with frame instructions
Instructions CALLSEQ_START..CALLSEQ_END and their target dependent
counterparts keep data like frame size, stack adjustment etc. These
data are accessed by getOperand using hard coded indices. It is
error prone way. This change implements the access by special methods,
which improve readability and allow changing data representation without
massive changes of index values.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300196 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 14:10:52 +00:00
NAKAMURA Takumi
4aae21ea76 llvm/test/BugPoint/compile-custom.ll: Use %/s for its path not to be mis-escaped.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300193 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 11:40:32 +00:00
Ayman Musa
67b50524f6 [X86] Added missing mayLoad/mayStore attributes to some X86 instructions.
Throughout the effort of automatically generating the X86 memory folding tables these missing information were encountered.
This is a preparation work for a future patch including the automation of these tables.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300190 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 10:03:45 +00:00
George Rimar
2c882c2737 [DWARF] - Simplify (use dyn_cast instead of isa + cast).
This addresses post commit review comments for r300039.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300188 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 09:52:50 +00:00
Daniel Sanders
78f9d9d6a4 [globalisel][tablegen] Report more detail in some SelectionDAG import failures. NFC
Reviewers: ab, t.p.northover, qcolombet, aditya_nandakumar, rovka

Reviewed By: ab

Subscribers: dberris, kristof.beyls, igorb, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300186 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 09:45:37 +00:00
Ayman Musa
4c76a12393 Reverting cmake/modules/AddLLVM.cmake changes from revision 300184 (Added by mistake).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300185 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 09:26:49 +00:00
Ayman Musa
456f727677 [X86] Change instructions names to keep consistency with the naming convention. NFC
Differential Revision: https://reviews.llvm.org/D31743



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300184 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 09:12:32 +00:00
Ayal Zaks
17f2fca608 [LV] Refactor ILV to provide vectorizeInstruction(); NFC
Refactoring InnerLoopVectorizer's vectorizeBlockInLoop() to provide
vectorizeInstruction(). Aligning DeadInstructions with its only user.
Facilitates driving the transformation by VPlan - follows
https://reviews.llvm.org/D28975 and its tentative breakdown.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300183 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 09:07:23 +00:00
Craig Topper
3d5761e1a9 Fix typo in static_assert message. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300179 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 07:31:52 +00:00
Lang Hames
679e17374b [ORC] Temporarily disable the RPC Error/Expected unit tests while I investigate
bot failures.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300177 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 06:20:45 +00:00
Lang Hames
e460ede847 [Orc] Fix bool serialization for RawByteChannels.
The bool type may be larger than the char type, so assuming we can cast from
bool to char and write a byte out to the stream is unsafe.

Hopefully this will get RPCUtilsTest.ReturnExpectedFailure passing on the bots.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300174 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 05:23:50 +00:00
Lang Hames
24828a324b [ORC] Remove more extraneous semicolons from r300167, rename the RPC Expected
tests to be consistent with the Error tests.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300173 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 05:05:26 +00:00
George Burgess IV
d613770733 Remove more lies from the LangRef.
Same change as in r300168, but for invoke instead of call.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300172 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 05:00:31 +00:00
Craig Topper
c170edb60b [APInt] Reorder fields to avoid a hole in the middle of the class
Summary:
APInt is currently implemented with an unsigned BitWidth field first and then a uint_64/pointer union. Due to the 64-bit size of the union there is a hole after the bitwidth.

Putting the union first allows the class to be packed. Making it 12 bytes instead of 16 bytes. An APSInt goes from 20 bytes to 16 bytes.

This shows a 4k reduction on the size of the opt binary on my local x86-64 build. So this enables some other improvement to the code as well.

Reviewers: dblaikie, RKSimon, hans, davide

Reviewed By: davide

Subscribers: davide, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300171 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 04:59:11 +00:00
Lang Hames
d8ea48f65f [ORC] Remove extraneous semi-colon added in r300167.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300170 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 04:49:00 +00:00
Craig Topper
cd686df68a [APInt] Generalize the implementation of tcIncrement to support adding a full 'word' by introducing tcAddPart. Use this to support tcIncrement, operator++ and operator+=(uint64_t). Do the same for subtract. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300169 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 04:36:06 +00:00
George Burgess IV
c1231f81ae Update the LangRef to reflect reality.
At the very least, we have CallInst::setIsNoInline() for adding the
noinline attribute to callsites, and I'm told alwaysinline seems to
work.

Thought of adding "not all attributes are guaranteed to work here". If
someone thinks that would be better (or has a better way of phrasing
that, etc.), happy to add it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300168 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 04:01:55 +00:00
Lang Hames
ed576a186f [ORC] Add RPC and serialization support for Errors and Expecteds.
This patch allows Error and Expected types to be passed to and returned from
RPC functions.

Serializers and deserializers for custom error types (types deriving from the
ErrorInfo class template) can be registered with the SerializationTraits for
a given channel type (see registerStringError in RPCSerialization.h for an
example), allowing a given custom type to be sent/received. Unregistered types
will be serialized/deserialized as StringErrors using the custom type's log
message as the error string.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300167 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 03:51:35 +00:00
Zachary Turner
55525ab26b Remove some unused private fields.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300163 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 02:28:17 +00:00
Craig Topper
422574b6f8 [InstCombine] Add vector version of a test to show missing optimization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300161 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 01:31:40 +00:00
Peter Collingbourne
8b69529e74 Support: Add a VCSRevision.h header file.
This is a magic header file supported by the build system that provides a
single definition, LLVM_REVISION, containing an LLVM revision identifier,
if available. This functionality previously lived in the LTO library, but
I am moving it out to lib/Support because I want to also start using it in
lib/Object to create the IR symbol table.

This change also fixes a bug where LLVM_REVISION was never actually being
used in lib/LTO because the macro HAS_LLVM_REVISION was never defined (it
was misspelled as HAVE_SVN_VERSION_INC in lib/LTO/CMakeLists.txt, and was
only being defined in a non-existent file Version.cpp).

I also changed the code to use "git rev-parse --git-dir" to locate the .git
directory, instead of looking for it in the LLVM source root directory,
which makes this compatible with monorepos as well as git worktrees.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300160 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 01:26:12 +00:00
Lang Hames
ebc666e155 [ORC] Add missing file from r300155.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300157 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 01:06:45 +00:00
Lang Hames
a43d3686c7 [ORC] Use native Errors rather than converted std::error_codes for ORC RPC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300155 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 01:03:06 +00:00
Reid Kleckner
e9a46bf123 [IR] Take func, ret, and arg attrs separately in AttributeList::get
This seems like a much more natural API, based on Derek Schuff's
comments on r300015. It further hides the implementation detail of
AttributeList that function attributes come last and appear at index
~0U, which is easy for the user to screw up. git diff says it saves code
as well: 97 insertions(+), 137 deletions(-)

This also makes it easier to change the implementation, which I want to
do next.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300153 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 00:58:09 +00:00
Craig Topper
2d32ddf143 [IR] Remove the APIntMoveTy typedef from ConstantRange. Use APInt type directly.
This typedef used to be conditional based on whether rvalue references were supported. Looks like it got left behind when we switched to always having rvalue references with c++11. I don't think it provides any value now.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300146 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 00:20:31 +00:00
Richard Smith
dc359e4a20 Work around MSVC rejects-valid bug related to C++11 narrowing conversions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300144 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 00:14:39 +00:00
Konstantin Zhuravlyov
fae6220cbb Fix compiler error in Attributes.cpp
```
Compiling Attributes.cpp ...
../../../Attributes.cpp: In member function 'std::__1::pair<unsigned int, llvm::Optional<unsigned int> > llvm::AttributeSet::getAllocSizeArgs() const':
../../../Attributes.cpp:542:69: error: operands to ?: have different types 'std::__1::pair<unsigned int, llvm::Optional<unsigned int> >' and 'std::__1::pair<int, int>'
   return SetNode ? SetNode->getAllocSizeArgs() : std::make_pair(0, 0);
                                                                     ^
../../../Attributes.cpp:543:1: error: control reaches end of non-void function [-Werror=return-type]
 }
 ^
```

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300143 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 23:57:37 +00:00
Wei Ding
24e7b0fb5c AMDGPU : Fix common dominator of two incoming blocks terminates with uniform branch issue.
Differential Revision: http://reviews.llvm.org/D31350

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300142 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 23:51:47 +00:00
Richard Smith
e22326d7b4 Fix some ArgList uses after API change in r300135.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300139 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 23:43:58 +00:00
Zachary Turner
71cd6a6292 Fix initialization order of class members.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300137 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 23:27:43 +00:00
Richard Smith
e05ab25f5d ArgList: cache index ranges containing arguments with each ID
Improve performance of argument list parsing with large numbers of IDs and
large numbers of arguments, by tracking a conservative range of indexes within
the argument list that might contain an argument with each ID. In the worst
case (when the first and last argument with a given ID are at the opposite ends
of the argument list), this still results in a linear-time walk of the list,
but it helps substantially in the common case where each ID occurs only once,
or a few times close together in the list.

This gives a ~10x speedup to clang's `test/Driver/response-file.c`, which
constructs a very large set of command line arguments and feeds them to the
clang driver.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300135 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 23:19:51 +00:00
Zachary Turner
67dcd802e3 [llvm-pdbdump] Minor prepatory refactor of Class Def Dumper.
In a followup patch I intend to introduce an additional dumping
mode which dumps a graphical representation of a class's layout.
In preparation for this, the text-based layout printer needs to
be split out from the graphical layout printer, and both need
to be able to use the same code for printing the intro and outro
of a class's definition (e.g. base class list, etc).

This patch does so, and in the process introduces a skeleton
definition for the graphical printer, while currently making
the graphical printer just print nothing.

NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300134 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 23:18:51 +00:00
Zachary Turner
7724dc63a7 [llvm-pdbdump] More advanced class definition dumping.
Previously the dumping of class definitions was very primitive,
and it made it hard to do more than the most trivial of output
formats when dumping.  As such, we would only dump one line for
each field, and then dump non-layout items like nested types
and enums.

With this patch, we do a complete analysis of the object
hierarchy including aggregate types, bases, virtual bases,
vftable analysis, etc.  The only immediately visible effects
of this are that a) we can now dump a line for the vfptr where
before we would treat that as padding, and b) we now don't
treat virtual bases that come at the end of a class as padding
since we have a more detailed analysis of the class's storage
usage.

In subsequent patches, we should be able to use this analysis
to display a complete graphical view of a class's layout including
recursing arbitrarily deep into an object's base class / aggregate
member hierarchy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300133 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 23:18:21 +00:00
Akira Hatanaka
69dba78684 [libFuzzer] XFAIL fuzzer-oom.test on Darwin.
The test fails on Darwin because Fuzzer::DeathCallback (which calls
DumpCurrentUnit("crash-")) is called before DumpCurrentUnit("oom-") is
called in Fuzzer::RssLimitCallback. DeathCallback is transitively called
from __sanitizer_print_memory_profile.

This should fix the fuzzer bot that has been failing for a while:

http://lab.llvm.org:8080/green/job/libFuzzer/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300127 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 23:15:10 +00:00
Craig Topper
b25869aa9e [InstSimplify] Don't try to constant fold AllocaInsts since it won't do anything.
Should give a small compile time improvement.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300125 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 22:54:24 +00:00
Reid Kleckner
f31bea8f80 [IR] Make AttributeSet constructor from AttributeSetNode* explicit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300119 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 22:30:37 +00:00
Craig Topper
53726fa11a [ValueTracking] Teach GetUnderlyingObject to stop when it reachs an alloca instruction.
Previously it tried to call SimplifyInstruction which doesn't know anything about alloca so defers to constant folding which also doesn't do anything with alloca. This results in wasted cycles making calls that won't do anything. Given the frequency with which this function is called this time adds up.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300118 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 22:29:23 +00:00
Reid Kleckner
7c6ef2a299 [IR] Assert that we never create an empty AttributeListImpl, NFC
Delete following conditional that is always true as a result.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300117 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 22:22:01 +00:00
Matt Arsenault
ab28f3b39e AMDGPU: Fix invalid copies when copying i1 to phys reg
Insert a VReg_1 virtual register so the i1 workaround pass
can handle it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300113 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 21:58:23 +00:00
Stanislav Mekhanoshin
bb9002fbb2 [AMDGPU] Generate range metadata for workitem id
If workgroup size is known inform llvm about range returned by local
id  and local size queries.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300102 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 20:48:56 +00:00
Piotr Padlewski
6f93f61542 Remove readnone from invariant.group.barrier
Summary:
Readnone attribute would cause CSE of two barriers with
the same argument, which is invalid by example:

    struct Base {
          virtual int foo() { return 42; }
    };

    struct Derived1 : Base {
          int foo() override { return 50; }
    };

    struct Derived2 : Base {
          int foo() override { return 100; }
    };

    void foo() {
        Base *x = new Base{};
        new (x) Derived1{};
        int a = std::launder(x)->foo();
        new (x) Derived2{};
        int b = std::launder(x)->foo();
    }

Here 2 calls of std::launder will produce @llvm.invariant.group.barrier,
which would be merged into one call, causing devirtualization
to devirtualize second call into Derived1::foo() instead of
Derived2::foo()

Reviewers: chandlerc, dberlin, hfinkel

Subscribers: llvm-commits, rsmith, amharc

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300101 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 20:45:12 +00:00
Vassil Vassilev
4f344492bb Append -w when LLVM_ENABLE_WARNINGS is Off.
Reviewed by rnk (D31702)!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300100 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 20:43:11 +00:00
Peter Collingbourne
5bfc47d152 Bitcode: Move version and global value module code parsers to separate functions. NFCI.
This will make it easier to teach this code about the string table.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300099 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 20:02:09 +00:00