Rafael Espindola [Mon, 17 Nov 2014 19:26:40 +0000 (19:26 +0000)]
Revert commits r222146 and r222137.
They were producing the wrong result if NumBits == BitsInWord. The old mask
produced -1, the new mask 0.
This should fix the 32 bit bots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222166
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Mon, 17 Nov 2014 17:51:45 +0000 (17:51 +0000)]
Fix GraphTraits for "const CallGraphNode *" and "const CallGraph *"
The specializations were broken. For example,
void foo(const CallGraph *G) {
auto I = GraphTraits<const CallGraph *>::nodes_begin(G);
auto K = I++;
...
}
or
void bar(const CallGraphNode *N) {
auto I = GraphTraits<const CallGraphNode *>::nodes_begin(G);
auto K = I++;
....
}
would not compile.
Patch by Speziale Ettore!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222149
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Mon, 17 Nov 2014 17:43:27 +0000 (17:43 +0000)]
Avoid undefined behavior by masking the shift amount.
Should hopefully fix the mips bots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222146
91177308-0d34-0410-b5e6-
96231b3b80d8
Chad Rosier [Mon, 17 Nov 2014 16:33:50 +0000 (16:33 +0000)]
[Reassociate] As the expression tree is rewritten make sure the operands are
emitted in canonical form.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222142
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Volkov [Mon, 17 Nov 2014 16:17:51 +0000 (16:17 +0000)]
[X86] Use ADD/SUB instead of INC/DEC for Haswell and Broadwell CPUs
Differential Revision: http://reviews.llvm.org/D5934
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222141
91177308-0d34-0410-b5e6-
96231b3b80d8
Chad Rosier [Mon, 17 Nov 2014 15:52:51 +0000 (15:52 +0000)]
[Reassociate] Canonicalize constants to RHS operand.
Fix a thinko where the RHS was already a constant.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222139
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Mon, 17 Nov 2014 15:46:21 +0000 (15:46 +0000)]
Use a more canonical way of computing a mask with N trailing 1s. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222137
91177308-0d34-0410-b5e6-
96231b3b80d8
Renato Golin [Mon, 17 Nov 2014 14:08:57 +0000 (14:08 +0000)]
Fix ARM triple parsing
The triple parser should only accept existing architecture names
when the triple starts with armv, armebv, thumbv or thumbebv.
Patch by Gabor Ballabas.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222129
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Mon, 17 Nov 2014 11:27:45 +0000 (11:27 +0000)]
ScalarEvolution: Construct SCEVDivision's Derived type instead of itself
SCEVDivision::divide constructed an object of SCEVDivision<Derived>
instead of Derived. divide would call visit which would cast the
SCEVDivision<Derived> to type Derived. As it happens,
SCEVDivision<Derived> and Derived currently have the same layout but
this is fragile and grounds for UB.
Instead, just construct Derived. No functional change intended.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222126
91177308-0d34-0410-b5e6-
96231b3b80d8
Oliver Stannard [Mon, 17 Nov 2014 11:18:10 +0000 (11:18 +0000)]
[Thumb1] Re-write emitThumbRegPlusImmediate
This was motivated by a bug which caused code like this to be
miscompiled:
declare void @take_ptr(i8*)
define void @test() {
%addr1.32 = alloca i8
%addr2.32 = alloca i32, i32 1028
call void @take_ptr(i8* %addr1)
ret void
}
This was emitting the following assembly to get the value of %addr1:
add r0, sp, #1020
add r0, r0, #8
However, "add r0, r0, #8" is not a valid Thumb1 instruction, and this
could not be assembled. The generated object file contained this,
resulting in r0 holding SP+8 rather tha SP+1028:
add r0, sp, #1020
add r0, sp, #8
This function looked like it could have caused miscompilations for
other combinations of registers and offsets (though I don't think it is
currently called with these), and the heuristic it used did not match
the emitted code in all cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222125
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Mon, 17 Nov 2014 11:17:17 +0000 (11:17 +0000)]
Object, COFF: Tighten the object file parser
We were a little lax in a few areas:
- We pretended that import libraries were like any old COFF file, they
are not. In fact, they aren't really COFF files at all, we should
probably grow some specialized functionality to handle them smarter.
- Our symbol iterators were more than happy to attempt to go past the
end of the symbol table if you had a symbol with a bad list of
auxiliary symbols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222124
91177308-0d34-0410-b5e6-
96231b3b80d8
Oliver Stannard [Mon, 17 Nov 2014 10:49:31 +0000 (10:49 +0000)]
Fix optimisations of SELECT_CC which assumed result is boolean
Some optimisations in DAGCombiner cause miscompilations for targets that use
TargetLowering::UndefinedBooleanContent, because they assume that the results
of a SELECT_CC node are boolean values, and can be safely ANDed, ORed and
XORed. These optimisations are only valid for targets that use
ZeroOrOneBooleanContent or ZeroOrNegativeOneBooleanContent.
This is a follow-up to D6210/r221693.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222123
91177308-0d34-0410-b5e6-
96231b3b80d8
Yaron Keren [Mon, 17 Nov 2014 09:29:33 +0000 (09:29 +0000)]
silence gcc 4.9.1 warning in /llvm/lib/Support/Windows/Path.inc:564:39:
warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if (ec = widenPath(path, path_utf16))
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222122
91177308-0d34-0410-b5e6-
96231b3b80d8
Erik Eckstein [Mon, 17 Nov 2014 09:13:57 +0000 (09:13 +0000)]
Optimize switch lookup tables with linear mapping.
This is a simple optimization for switch table lookup:
It computes the output value directly with an (optional) mul and add if there is a linear mapping between index and output.
Example:
int f1(int x) {
switch (x) {
case 0: return 10;
case 1: return 11;
case 2: return 12;
case 3: return 13;
}
return 0;
}
generates:
define i32 @f1(i32 %x) #0 {
entry:
%0 = icmp ult i32 %x, 4
br i1 %0, label %switch.lookup, label %return
switch.lookup:
%switch.offset = add i32 %x, 10
ret i32 %switch.offset
return:
ret i32 0
}
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222121
91177308-0d34-0410-b5e6-
96231b3b80d8
Bob Wilson [Mon, 17 Nov 2014 08:00:45 +0000 (08:00 +0000)]
Fix CR/LF line endings in test case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222120
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Mon, 17 Nov 2014 05:58:26 +0000 (05:58 +0000)]
Add missing semicolon from r222118.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222119
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Mon, 17 Nov 2014 05:50:14 +0000 (05:50 +0000)]
Move register class name strings to a single array in MCRegisterInfo to reduce static table size and number of relocation entries.
Indices into the table are stored in each MCRegisterClass instead of a pointer. A new method, getRegClassName, is added to MCRegisterInfo and TargetRegisterInfo to lookup the string in the table.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222118
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Mon, 17 Nov 2014 02:28:27 +0000 (02:28 +0000)]
Add back r222061 with a fix.
This adds back r222061, but now calls initializePAEvalPass from the correct
library to avoid link problems.
Original message:
Don't make assumptions about the name of private global variables.
Private variables are can be renamed, so it is not reliable to make
decisions on the name.
The name is also dropped by the assembler before getting to the
linker, so using the name causes a disconnect between how llvm makes a
decision (var name) and how the linker makes a decision (section it is
in).
This patch changes one case where we were looking at the variable name to use
the section instead.
Test tuning by Michael Gottesman.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222117
91177308-0d34-0410-b5e6-
96231b3b80d8
Frederic Riss [Mon, 17 Nov 2014 01:34:15 +0000 (01:34 +0000)]
Implement MachODumper::printFileHeaders
Patch by Chilledheart.
Differential Revision: http://reviews.llvm.org/D6163
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222115
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Mon, 17 Nov 2014 00:26:50 +0000 (00:26 +0000)]
Replace a couple asserts with static_asserts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222114
91177308-0d34-0410-b5e6-
96231b3b80d8
Tobias Grosser [Sun, 16 Nov 2014 21:19:35 +0000 (21:19 +0000)]
Fix typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222110
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sun, 16 Nov 2014 21:17:18 +0000 (21:17 +0000)]
Convert some EVTs to MVTs where only a SimpleValueType is needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222109
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Sun, 16 Nov 2014 20:35:19 +0000 (20:35 +0000)]
ScalarEvolution: Introduce SCEVSDivision and SCEVUDivision
It turns out that not all users of SCEVDivision want the same
signedness. Let the users determine which operation they'd like by
explicitly choosing SCEVUDivision or SCEVSDivision.
findArrayDimensions and computeAccessFunctions will use SCEVSDivision
while HowFarToZero will use SCEVUDivision.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222104
91177308-0d34-0410-b5e6-
96231b3b80d8
Jingyue Wu [Sun, 16 Nov 2014 16:52:44 +0000 (16:52 +0000)]
[DependenceAnalysis] Allow subscripts of different types
Summary:
Several places in DependenceAnalysis assumes both SCEVs in a subscript pair
share the same integer type. For instance, isKnownPredicate calls
SE->getMinusSCEV(X, Y) which asserts X and Y share the same type. However,
DependenceAnalysis fails to ensure this assumption when producing a subscript
pair, causing tests such as NonCanonicalizedSubscript to crash. With this
patch, DependenceAnalysis runs unifySubscriptType before producing any
subscript pair, ensuring the assumption.
Test Plan:
Added NonCanonicalizedSubscript.ll on which DependenceAnalysis before the fix
crashed because subscripts have different types.
Reviewers: spop, sebpop, jingyue
Reviewed By: jingyue
Subscribers: eliben, meheff, llvm-commits
Differential Revision: http://reviews.llvm.org/D6289
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222100
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sun, 16 Nov 2014 09:24:16 +0000 (09:24 +0000)]
[x86] Remove two redundant isel patterns. They equivalent already exists in the instruction pattern.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222094
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Sun, 16 Nov 2014 07:30:35 +0000 (07:30 +0000)]
ScalarEvolution: HowFarToZero was wrongly using signed division
HowFarToZero was supposed to use unsigned division in order to calculate
the backedge taken count. However, SCEVDivision::divide performs signed
division. Unless I am mistaken, no users of SCEVDivision actually want
signed arithmetic: switch to udiv and urem.
This fixes PR21578.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222093
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Sun, 16 Nov 2014 02:20:08 +0000 (02:20 +0000)]
InstSimplify: Optimize ICmpInst xform that uses computeKnownBits
A few things:
- computeKnownBits is relatively expensive, let's delay its use as long
as we can.
- Don't create two APInt values just to run computeKnownBits on a
ConstantInt, we already know the exact value!
- Avoid creating a temporary APInt value in order to calculate unary
negation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222092
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrea Di Biagio [Sat, 15 Nov 2014 22:56:25 +0000 (22:56 +0000)]
[DAG] Improved target independent vector shuffle folding logic.
This patch teaches the DAGCombiner how to combine shuffles according to rules:
shuffle(shuffle(A, Undef, M0), B, M1) -> shuffle(B, A, M2)
shuffle(shuffle(A, B, M0), B, M1) -> shuffle(B, A, M2)
shuffle(shuffle(A, B, M0), A, M1) -> shuffle(B, A, M2)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222090
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Sat, 15 Nov 2014 21:13:05 +0000 (21:13 +0000)]
[X86][SSE] Improve legal SHUFP and PSHUFD shuffle matching
Updated X86TargetLowering::isShuffleMaskLegal to match SHUFP masks with commuted inputs and PSHUFD masks that reference the second input.
As part of this I've refactored isPSHUFDMask to work in a more general manner and allow it to match against either the first or second input vector.
Differential Revision: http://reviews.llvm.org/D6287
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222087
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Sat, 15 Nov 2014 10:53:12 +0000 (10:53 +0000)]
Dispose disassembler after use in unit test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222083
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Fiselier [Sat, 15 Nov 2014 07:45:31 +0000 (07:45 +0000)]
Provide missing definition of uppercase_CMAKE_BUILD_TYPE in HandleLLVMOptions module
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222082
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Sat, 15 Nov 2014 05:02:57 +0000 (05:02 +0000)]
R600: Permute operands when selecting legacy min/max
This gets the correct NaN behavior based on the compare type
the hardware uses. This now passes the new piglit test I have
for this on SI.
Add stricter tests for the operand order.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222079
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Sat, 15 Nov 2014 02:03:59 +0000 (02:03 +0000)]
yaml2obj, COFF: Consider the DOS stub when laying out section headers
While this program worked correctly with small example programs, larger
ones tickled this bug. I'm working on a reduction because my program is
quite large.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222078
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Sat, 15 Nov 2014 02:03:53 +0000 (02:03 +0000)]
Revert "Don't make assumptions about the name of private global variables."
This reverts commit r222061.
It's causing linker errors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222077
91177308-0d34-0410-b5e6-
96231b3b80d8
Tom Stellard [Sat, 15 Nov 2014 01:07:57 +0000 (01:07 +0000)]
R600: Fix 64-bit integer division
This fixes a failure in one of the oclconform tests.
Patch by: Jan Vesely
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222073
91177308-0d34-0410-b5e6-
96231b3b80d8
Tom Stellard [Sat, 15 Nov 2014 01:07:53 +0000 (01:07 +0000)]
R600: Factor i64 UDIVREM lowering into its own fuction
This is so it could potentially be used by SI. However, the current
implementation does not always produce correct results, so the
IntegerDivisionPass is being used instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222072
91177308-0d34-0410-b5e6-
96231b3b80d8
Duncan P. N. Exon Smith [Sat, 15 Nov 2014 00:23:49 +0000 (00:23 +0000)]
DIBuilder: Use Constant instead of Value
Make explicit the requirement that most IR values in `DIBuilder` are
`Constant`. This requires a follow-up change in clang.
Part of PR21532.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222070
91177308-0d34-0410-b5e6-
96231b3b80d8
Duncan P. N. Exon Smith [Sat, 15 Nov 2014 00:05:04 +0000 (00:05 +0000)]
DIBuilder: Change private helper function to static, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222068
91177308-0d34-0410-b5e6-
96231b3b80d8
Duncan P. N. Exon Smith [Fri, 14 Nov 2014 23:58:20 +0000 (23:58 +0000)]
IR: Remove MDString logic for Value::hasName()
This isn't necessary after r221960.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222067
91177308-0d34-0410-b5e6-
96231b3b80d8
Duncan P. N. Exon Smith [Fri, 14 Nov 2014 23:55:52 +0000 (23:55 +0000)]
DIBuilder: Cleanup access control style, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222066
91177308-0d34-0410-b5e6-
96231b3b80d8
Duncan P. N. Exon Smith [Fri, 14 Nov 2014 23:55:03 +0000 (23:55 +0000)]
DI: Use Metadata for DITypeRef and DIScopeRef
Now that `MDString` and `MDNode` have a common base class, use it. Note
that it's not useful to assume subclasses of `Metadata` must be one or
the other since we'll be adding more subclasses soon enough.
Part of PR21532.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222064
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Fri, 14 Nov 2014 23:31:07 +0000 (23:31 +0000)]
Rename EH related stuff to be more precise
Summary:
The current "WinEH" exception handling type is more about Itanium-style
LSDA tables layered on top of the Windows native unwind info format
instead of .eh_frame tables or EHABI unwind info. Use the name
"ItaniumWinEH" to better reflect the hybrid nature of the design.
Also rename isExceptionHandlingDWARF to usesItaniumLSDAForExceptions,
since the LSDA is part of the Itanium C++ ABI document, and not the
DWARF standard.
Reviewers: echristo
Subscribers: llvm-commits, compnerd
Differential Revision: http://reviews.llvm.org/D6279
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222062
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Fri, 14 Nov 2014 23:17:47 +0000 (23:17 +0000)]
Don't make assumptions about the name of private global variables.
Private variables are can be renamed, so it is not reliable to make
decisions on the name.
The name is also dropped by the assembler before getting to the
linker, so using the name causes a disconnect between how llvm makes a
decision (var name) and how the linker makes a decision (section it is
in).
This patch changes one case where we were looking at the variable name to use
the section instead.
Test tuning by Michael Gottesman.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222061
91177308-0d34-0410-b5e6-
96231b3b80d8
Tim Northover [Fri, 14 Nov 2014 22:45:33 +0000 (22:45 +0000)]
ARM: refactor .cfi_def_cfa_offset emission.
We use to track quite a few "adjusted" offsets through the FrameLowering code
to account for changes in the prologue instructions as we went and allow the
emission of correct CFA annotations. However, we were missing a couple of cases
and the code was almost impenetrable.
It's easier to just add any stack-adjusting instruction to a list and emit them
together.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222057
91177308-0d34-0410-b5e6-
96231b3b80d8
Tim Northover [Fri, 14 Nov 2014 22:45:31 +0000 (22:45 +0000)]
ARM: correctly calculate the offset of FP in its push.
When we folded the DPR alignment gap into a push, we weren't noting the extra
distance from the beginning of the push to the FP, and so FP ended up pointing
at an incorrect offset.
The .cfi_def_cfa_offset directives are still wrong in this case, but I think
that can be improved by refactoring.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222056
91177308-0d34-0410-b5e6-
96231b3b80d8
Tim Northover [Fri, 14 Nov 2014 22:45:23 +0000 (22:45 +0000)]
ARM: simplify test.
The test's DWARF stubs were there just to trigger the emission of .cfi
directives. Fortunately, the NetBSD ABI already demands proper DWARF unwind
info, so it's easier to just use that triple.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222055
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Fri, 14 Nov 2014 22:10:16 +0000 (22:10 +0000)]
Rerun AutoRegen.sh.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222050
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Fri, 14 Nov 2014 21:53:50 +0000 (21:53 +0000)]
Turn a leaked object into a stack variable instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222046
91177308-0d34-0410-b5e6-
96231b3b80d8
Kevin Enderby [Fri, 14 Nov 2014 21:52:18 +0000 (21:52 +0000)]
Add the code and test cases for 64-bit ARM to llvm-objdump’s Mach-O symbolizer.
FYI, removed the unused MCInstrAnalysis as it does not exist for 64-bit ARM and
was causing a “couldn't initialize disassembler for target” error.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222045
91177308-0d34-0410-b5e6-
96231b3b80d8
Frederic Riss [Fri, 14 Nov 2014 21:23:26 +0000 (21:23 +0000)]
Add a test for r222029 that doesn't rely on the default target being a COFF platform.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222041
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Fri, 14 Nov 2014 21:21:15 +0000 (21:21 +0000)]
InstCombine: Fix infinite loop caused by visitFPTrunc
We would attempt to replace a fptrunc of an frem with an identical
fptrunc. This would cause the new fptrunc to be added to the worklist.
Of course, this results in an infinite loop because we will keep
visiting the newly created fptruncs.
This fixes PR21576.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222040
91177308-0d34-0410-b5e6-
96231b3b80d8
Chad Rosier [Fri, 14 Nov 2014 21:09:13 +0000 (21:09 +0000)]
Reapply r221924: "[GVN] Perform Scalar PRE on gep indices that feed loads before
doing Load PRE"
This commit updates the failing test in
Analysis/TypeBasedAliasAnalysis/gvn-nonlocal-type-mismatch.ll
The failing test is sensitive to the order in which we process loads. This
version turns on the RPO traversal instead of the while DT traversal in GVN.
The new test code is functionally same just the order of loads that are
eliminated is swapped.
This new version also fixes an issue where GVN splits a critical edge and
potentially invalidate the RPO/DT iterator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222039
91177308-0d34-0410-b5e6-
96231b3b80d8
Bill Schmidt [Fri, 14 Nov 2014 21:05:45 +0000 (21:05 +0000)]
Change order of tablegen generated fast-isel instruction code to be
based on instruction complexity
The order that tablegen fast-isel instruction code is generated is
currently based on the text of the predicate (using string
less-than). This patch changes this to instead use the instruction
complexity. Because the complexities are not unique a C++ multimap is
used instead of a map.
This fixes the problem where code with no predicate always comes out
first (the empty string always compares as less than all other
strings) thus making the code with predicates dead code. See the FMUL
code in PPCFastISel.cpp for an example. It also more closely matches
the normal codegen ordering. Some error checking in the tablegen
fast-isel code is fixed as well.
Patch by Bill Seurer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222038
91177308-0d34-0410-b5e6-
96231b3b80d8
Tom Stellard [Fri, 14 Nov 2014 20:43:28 +0000 (20:43 +0000)]
R600/SI: Mark s_movk_i32 as rematerializable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222037
91177308-0d34-0410-b5e6-
96231b3b80d8
Tom Stellard [Fri, 14 Nov 2014 20:43:26 +0000 (20:43 +0000)]
R600/SI: Fix spilling of m0 register
If we have spilled the value of the m0 register, then we need to restore
it with v_readlane_b32 to a regular sgpr, because v_readlane_b32 can't
write to m0.
v_readlane_b32 can't write to m0, so
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222036
91177308-0d34-0410-b5e6-
96231b3b80d8
Frederic Riss [Fri, 14 Nov 2014 20:33:40 +0000 (20:33 +0000)]
COFF: Add support for Dwarf accelerator tables.
This allows COFF targets to emit accelerator tables
when requested by -dwarf-accel-tables=Enable instead
of aborting. The test DebugInfo/cross-cu-inlining.ll
covers this on COFF platforms.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222034
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Fri, 14 Nov 2014 20:08:52 +0000 (20:08 +0000)]
R600/SI: Combine min3/max3 instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222032
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Fri, 14 Nov 2014 19:35:59 +0000 (19:35 +0000)]
yaml2obj, COFF: Correctly calculate SizeOfImage and SizeOfHeaders
SizeOfHeaders must be aligned to the FileAlignment.
SizeOfImage must be at least the SizeOfHeaders aligned to the
SectionAlignment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222030
91177308-0d34-0410-b5e6-
96231b3b80d8
Frederic Riss [Fri, 14 Nov 2014 19:30:08 +0000 (19:30 +0000)]
[dwarfdump] Handle relocations in Dwarf accelerator tables
ELF targets (and maybe COFF) use relocations when referring
to strings in the .debug_str section. Handle that in the
accelerator table dumper. This commit restores the
test/DebugInfo/cross-cu-inlining.ll test to its expected
platform independant form, validating that the fix works
(this test failed on linux boxes).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222029
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Fri, 14 Nov 2014 19:06:36 +0000 (19:06 +0000)]
Remove redundant virtual on overriden functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222023
91177308-0d34-0410-b5e6-
96231b3b80d8
Duncan P. N. Exon Smith [Fri, 14 Nov 2014 18:45:40 +0000 (18:45 +0000)]
IR: Make MDString inherit from Metadata
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222022
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Fri, 14 Nov 2014 18:43:41 +0000 (18:43 +0000)]
R600/SI: Fix verifier error from a branch on IMPLICIT_DEF
SIILowerI1Copies wasn't correctly handling this case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222020
91177308-0d34-0410-b5e6-
96231b3b80d8
Duncan P. N. Exon Smith [Fri, 14 Nov 2014 18:42:09 +0000 (18:42 +0000)]
IR: Take an LLVMContext in Metadata::Metadata()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222019
91177308-0d34-0410-b5e6-
96231b3b80d8
Duncan P. N. Exon Smith [Fri, 14 Nov 2014 18:42:06 +0000 (18:42 +0000)]
Add a blank line, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222018
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Fri, 14 Nov 2014 18:40:49 +0000 (18:40 +0000)]
Fix unused variable warning without asserts
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222017
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Fri, 14 Nov 2014 18:30:06 +0000 (18:30 +0000)]
R600/SI: Match integer min / max instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222015
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Fri, 14 Nov 2014 18:18:16 +0000 (18:18 +0000)]
R600/SI: Use S_BFE_I64 for 64-bit sext_inreg
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222012
91177308-0d34-0410-b5e6-
96231b3b80d8
Chad Rosier [Fri, 14 Nov 2014 17:09:19 +0000 (17:09 +0000)]
[Reassociate] Canonicalize the operands of all binary operators.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222008
91177308-0d34-0410-b5e6-
96231b3b80d8
Frederic Riss [Fri, 14 Nov 2014 17:08:18 +0000 (17:08 +0000)]
Tentatively appease the bots.
If this workaround gets the bots green, then we have to find out
why the -dwarf-accel-tables=Enable option doesn't work as
expected on non-darwin platforms.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222007
91177308-0d34-0410-b5e6-
96231b3b80d8
Chad Rosier [Fri, 14 Nov 2014 17:08:15 +0000 (17:08 +0000)]
[Reassociate] Canonicalize operands of vector binary operators.
Prior to this commit fmul and fadd binary operators were being canonicalized for
both scalar and vector versions. We now canonicalize add, mul, and, or, and xor
vector instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222006
91177308-0d34-0410-b5e6-
96231b3b80d8
Chad Rosier [Fri, 14 Nov 2014 17:05:59 +0000 (17:05 +0000)]
[Reassociate] Canonicalize constants to RHS operand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222005
91177308-0d34-0410-b5e6-
96231b3b80d8
Frederic Riss [Fri, 14 Nov 2014 16:15:53 +0000 (16:15 +0000)]
Reapply "[dwarfdump] Add support for dumping accelerator tables."
This reverts commit r221842 which was a revert of r221836 and of the
test parts of r221837.
This new version fixes an UB bug pointed out by David (along with
addressing some other review comments), makes some dumping more
resilient to broken input data and forces the accelerator tables
to be dumped in the tests where we use them (this decision is
platform specific otherwise).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222003
91177308-0d34-0410-b5e6-
96231b3b80d8
Cameron McInally [Fri, 14 Nov 2014 15:43:00 +0000 (15:43 +0000)]
[AVX512] Add 512b masked integer shift by immediate patterns.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222002
91177308-0d34-0410-b5e6-
96231b3b80d8
Chad Rosier [Fri, 14 Nov 2014 15:01:38 +0000 (15:01 +0000)]
[Reassociate] Improve rank debug information. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221999
91177308-0d34-0410-b5e6-
96231b3b80d8
Tom Stellard [Fri, 14 Nov 2014 14:08:04 +0000 (14:08 +0000)]
R600/SI: Fix assembly names for exec_hi and exec_lo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221995
91177308-0d34-0410-b5e6-
96231b3b80d8
Tom Stellard [Fri, 14 Nov 2014 14:08:00 +0000 (14:08 +0000)]
R600/SI: Start implementing an assembler
This was done using the Sparc and PowerPC AsmParsers as guides. So far it
is very simple and only supports sopp instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221994
91177308-0d34-0410-b5e6-
96231b3b80d8
Bill Schmidt [Fri, 14 Nov 2014 12:10:40 +0000 (12:10 +0000)]
[PowerPC] Add VSX builtins for vec_div
This patch adds builtin support for xvdivdp and xvdivsp, along with a
test case. Straightforward stuff.
There's a companion patch for Clang.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221983
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Fri, 14 Nov 2014 08:38:17 +0000 (08:38 +0000)]
Calm down build bots
r221975 seemed to trigger an ambiguous conversion that only irritated
clang, not gcc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221977
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Fri, 14 Nov 2014 08:15:42 +0000 (08:15 +0000)]
obj2yaml, yaml2obj: Add support for COFF executables
In support of serializing executables, obj2yaml now records the virtual address
and size of sections. It also serializes whatever we strictly need from
the PE header, it expects that it can reconstitute everything else via
inference.
yaml2obj can reconstitute a fully linked executable.
In order to get executables correctly serialized/deserialized, other
bugs were fixed as a circumstance. We now properly respect file and
section alignments. We also avoid writing out string tables unless they
are strictly necessary.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221975
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Fri, 14 Nov 2014 07:02:38 +0000 (07:02 +0000)]
Use size_type for operator[].
This matches std::vector and is more efficient as it avoids
truncations.
With this the text segment of opt goes from
19705442 bytes
to
19703930 bytes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221973
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Fri, 14 Nov 2014 04:53:55 +0000 (04:53 +0000)]
SearchForAddressOfSymbol(): Disable 3 symbols, copysignf, fminf, and fmaxf, on msc17. *These were added in VS 2013*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221971
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Fri, 14 Nov 2014 02:21:58 +0000 (02:21 +0000)]
R600/SI: Make constant array static
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221965
91177308-0d34-0410-b5e6-
96231b3b80d8
Justin Bogner [Fri, 14 Nov 2014 01:50:32 +0000 (01:50 +0000)]
llvm-cov: Sink some reporting logic into CoverageMapping
This teaches CoverageMapping::getCoveredFunctions to filter to a
particular file and uses that to replace most of the logic found in
llvm-cov report.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221962
91177308-0d34-0410-b5e6-
96231b3b80d8
Tim Northover [Fri, 14 Nov 2014 01:30:14 +0000 (01:30 +0000)]
X86: use getConstant rather than getTargetConstant behind BUILD_VECTOR.
getTargetConstant should only be used when you can guarantee the instruction
selected will be able to cope with the raw value. BUILD_VECTOR is rather too
generic for this so we should use getConstant instead. In that case, an
instruction can still consume the constant, but if it doesn't it'll be
materialised through its own round of ISel.
Should fix PR21352.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221961
91177308-0d34-0410-b5e6-
96231b3b80d8
Duncan P. N. Exon Smith [Fri, 14 Nov 2014 01:17:09 +0000 (01:17 +0000)]
IR: Rewrite uniquing and creation of MDString
Stop using `Value::getName()` to get the string behind an `MDString`.
Switch to `StringMapEntry<MDString>` so that we can find the string by
its coallocation.
This is part of PR21532.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221960
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Fri, 14 Nov 2014 00:41:46 +0000 (00:41 +0000)]
StringMap: Test and finish off supporting perfectly forwarded values in StringMap operations.
Followup to r221946.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221958
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Fri, 14 Nov 2014 00:41:42 +0000 (00:41 +0000)]
Fix 80 cols caught by the linter...
We have a linter running in our build now?
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221957
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Fri, 14 Nov 2014 00:39:33 +0000 (00:39 +0000)]
Fix build of Mips code with MSVC by using our macro instead of __attribute__((unused)) directly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221956
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Fri, 14 Nov 2014 00:35:50 +0000 (00:35 +0000)]
Allow the use of functions as typeinfo in landingpad clauses
This is one step towards supporting SEH filter functions in LLVM.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221954
91177308-0d34-0410-b5e6-
96231b3b80d8
Tim Northover [Fri, 14 Nov 2014 00:34:59 +0000 (00:34 +0000)]
CodeGen: assert an instruction is being inserted with the correct iterator.
When "MBB->Insert(It, ...)" is called, we want It to be pointing inside the
correct basic block. No actual failures at the moment, but it's caused problems
before.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221953
91177308-0d34-0410-b5e6-
96231b3b80d8
Duncan P. N. Exon Smith [Thu, 13 Nov 2014 23:59:16 +0000 (23:59 +0000)]
IR: Make MDString::getName() private
Hide the fact that `MDString`'s string is stored in `Value::Name` --
that's going to change soon. Update the only in-tree client that was
using it instead of `Value::getString()`.
Part of PR21532.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221951
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Thu, 13 Nov 2014 23:45:50 +0000 (23:45 +0000)]
Fix the VS 2012 build
VS 2012 doesn't have fminf or fmaxf.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221949
91177308-0d34-0410-b5e6-
96231b3b80d8
Reed Kotler [Thu, 13 Nov 2014 23:37:45 +0000 (23:37 +0000)]
First stage of call lowering for Mips fast-isel
Summary:
This has most of what is needed for mips fast-isel call lowering for O32.
What is missing I will add on the next patch because this patch is already too large.
It should not be doing anything wrong but it will punt on some cases that it is basically
capable of doing.
The mechanism is there for parameters to be passed on the stack but I have not enabled it because it serves as a way for now to prevent some of the strange cases of O32 register passing that I have not fully checked yet and have some issues.
The Mips O32 abi rules are very complicated as far how data is passed in floating and integer registers.
However there is a way to think about this all very simply and this implementation reflects that.
Basically, the ABI rules are written as if everything is passed on the stack and aligned as such.
Once that is conceptually done, it is nearly trivial to reassign those locations to registers and
then all the complexity disappears.
So I have told tablegen that all the data is passed on the stack and during the lowering I fix
this by assigning to registers as per the ABI doc.
This has been my approach and you can line up what I did with the ABI document and see 1 to 1 what
is going on.
Test Plan: callabi.ll
Reviewers: dsanders
Reviewed By: dsanders
Subscribers: jholewinski, echristo, ahatanak, llvm-commits, rfuhler
Differential Revision: http://reviews.llvm.org/D5714
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221948
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Thu, 13 Nov 2014 23:32:52 +0000 (23:32 +0000)]
Fix symbol resolution of floating point libc builtins in MCJIT
Fix for LLI failure on Windows\X86: http://llvm.org/PR5053
LLI.exe crashes on Windows\X86 when single precession floating point
intrinsics like the following are used: acos, asin, atan, atan2, ceil,
copysign, cos, cosh, exp, floor, fmin, fmax, fmod, log, pow, sin, sinh,
sqrt, tan, tanh
The above intrinsics are defined as inline-expansions in math.h, and are
not exported by msvcr120.dll (Win32 API GetProcAddress returns null).
For an FREM instruction, the JIT compiler generates a call to a stub for
the fmodf() intrinsic, and adds a relocation to fixup at load time. The
loader searches the libraries for the function, but fails because the
symbol is not exported. So, the call target remains NULL and the
execution crashes.
Since the math functions are loaded at JIT/runtime, the JIT can patch
CALL instruction directly instead of the searching the libraries'
exported symbols. However, this fix caused build failures due to
unresolved symbols like _fmodf at link time.
Therefore, the current fix defines helper functions in the Runtime
link/load library to perform the above operations. The address of these
helper functions are used to patch up the CALL instruction at load time.
Reviewers: lhames, rnk
Reviewed By: rnk
Differential Revision: http://reviews.llvm.org/D5387
Patch by Swaroop Sridhar!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221947
91177308-0d34-0410-b5e6-
96231b3b80d8
Duncan P. N. Exon Smith [Thu, 13 Nov 2014 23:23:02 +0000 (23:23 +0000)]
ADT: Use perfect forwarding in StringMapEntry::Create()
Now you can pass references into constructors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221946
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Thu, 13 Nov 2014 23:07:55 +0000 (23:07 +0000)]
Relax the gcov version.ll test to check '.' instead of '\*'
The escaping of the '\*' doesn't work with my combination of testing
tools.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221944
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Thu, 13 Nov 2014 23:07:22 +0000 (23:07 +0000)]
Silence MSVC warning on missing return after fully covered switch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221943
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Thu, 13 Nov 2014 23:03:09 +0000 (23:03 +0000)]
R600/SI: Fix fmin_legacy / fmax_legacy matching for SI
select_cc is expanded on SI, so this was never matched.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221941
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Thu, 13 Nov 2014 22:55:19 +0000 (22:55 +0000)]
Use nullptr instead of NULL for variadic sentinels
Windows defines NULL to 0, which when used as an argument to a variadic
function, is not a null pointer constant. As a result, Clang's
-Wsentinel fires on this code. Using '0' would be wrong on most 64-bit
platforms, but both MSVC and Clang make it work on Windows. Sidestep the
issue with nullptr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221940
91177308-0d34-0410-b5e6-
96231b3b80d8
Chad Rosier [Thu, 13 Nov 2014 22:54:59 +0000 (22:54 +0000)]
Revert "[GVN] Perform Scalar PRE on gep indices that feed loads before doing Load PRE."
This reverts commit r221924. It appears the commit was a bit premature and is causing
bot failures that need further investigation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221939
91177308-0d34-0410-b5e6-
96231b3b80d8