1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00
Commit Graph

109784 Commits

Author SHA1 Message Date
Rafael Espindola
2219d06019 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.

llvm-svn: 222166
2014-11-17 19:26:40 +00:00
Rafael Espindola
c4ad534f81 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!

llvm-svn: 222149
2014-11-17 17:51:45 +00:00
Rafael Espindola
b5013b22ca Avoid undefined behavior by masking the shift amount.
Should hopefully fix the mips bots.

llvm-svn: 222146
2014-11-17 17:43:27 +00:00
Chad Rosier
2db8cbf601 [Reassociate] As the expression tree is rewritten make sure the operands are
emitted in canonical form.

llvm-svn: 222142
2014-11-17 16:33:50 +00:00
Alexey Volkov
3cc8e8e28b [X86] Use ADD/SUB instead of INC/DEC for Haswell and Broadwell CPUs
Differential Revision: http://reviews.llvm.org/D5934

llvm-svn: 222141
2014-11-17 16:17:51 +00:00
Chad Rosier
fc00bbc305 [Reassociate] Canonicalize constants to RHS operand.
Fix a thinko where the RHS was already a constant.

llvm-svn: 222139
2014-11-17 15:52:51 +00:00
Rafael Espindola
354dd14330 Use a more canonical way of computing a mask with N trailing 1s. NFC.
llvm-svn: 222137
2014-11-17 15:46:21 +00:00
Renato Golin
b92ad16856 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.

llvm-svn: 222129
2014-11-17 14:08:57 +00:00
David Majnemer
b5ae33d9e3 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.

llvm-svn: 222126
2014-11-17 11:27:45 +00:00
Oliver Stannard
93a823bc7a [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.

llvm-svn: 222125
2014-11-17 11:18:10 +00:00
David Majnemer
903d9c0ab0 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.

llvm-svn: 222124
2014-11-17 11:17:17 +00:00
Oliver Stannard
2efad103c3 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.

llvm-svn: 222123
2014-11-17 10:49:31 +00:00
Yaron Keren
6469f7bd2d 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))

llvm-svn: 222122
2014-11-17 09:29:33 +00:00
Erik Eckstein
49292b906e 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
}

llvm-svn: 222121
2014-11-17 09:13:57 +00:00
Bob Wilson
0774bc6c56 Fix CR/LF line endings in test case.
llvm-svn: 222120
2014-11-17 08:00:45 +00:00
Craig Topper
bc3d6e1d6d Add missing semicolon from r222118.
llvm-svn: 222119
2014-11-17 05:58:26 +00:00
Craig Topper
5b6e56da60 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.

llvm-svn: 222118
2014-11-17 05:50:14 +00:00
Rafael Espindola
7382f6d0d4 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.

llvm-svn: 222117
2014-11-17 02:28:27 +00:00
Frederic Riss
21adb20a7e Implement MachODumper::printFileHeaders
Patch by Chilledheart.

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

llvm-svn: 222115
2014-11-17 01:34:15 +00:00
Craig Topper
2aa3e27053 Replace a couple asserts with static_asserts.
llvm-svn: 222114
2014-11-17 00:26:50 +00:00
Tobias Grosser
06ecea1ee5 Fix typo
llvm-svn: 222110
2014-11-16 21:19:35 +00:00
Craig Topper
5121b0369b Convert some EVTs to MVTs where only a SimpleValueType is needed.
llvm-svn: 222109
2014-11-16 21:17:18 +00:00
David Majnemer
f2223dee20 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.

llvm-svn: 222104
2014-11-16 20:35:19 +00:00
Jingyue Wu
230717d66d [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

llvm-svn: 222100
2014-11-16 16:52:44 +00:00
Craig Topper
eb88940e3d [x86] Remove two redundant isel patterns. They equivalent already exists in the instruction pattern.
llvm-svn: 222094
2014-11-16 09:24:16 +00:00
David Majnemer
7e29d637c6 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.

llvm-svn: 222093
2014-11-16 07:30:35 +00:00
David Majnemer
12827e608f 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.

llvm-svn: 222092
2014-11-16 02:20:08 +00:00
Andrea Di Biagio
5475bc1d1b [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)

llvm-svn: 222090
2014-11-15 22:56:25 +00:00
Simon Pilgrim
5e170d7652 [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

llvm-svn: 222087
2014-11-15 21:13:05 +00:00
Benjamin Kramer
4b4f2f5732 Dispose disassembler after use in unit test.
llvm-svn: 222083
2014-11-15 10:53:12 +00:00
Eric Fiselier
b0df52fd4a Provide missing definition of uppercase_CMAKE_BUILD_TYPE in HandleLLVMOptions module
llvm-svn: 222082
2014-11-15 07:45:31 +00:00
Matt Arsenault
1298bf6e9c 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.

llvm-svn: 222079
2014-11-15 05:02:57 +00:00
David Majnemer
16e206043f 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.

llvm-svn: 222078
2014-11-15 02:03:59 +00:00
Reid Kleckner
30a587b9ae Revert "Don't make assumptions about the name of private global variables."
This reverts commit r222061.

It's causing linker errors.

llvm-svn: 222077
2014-11-15 02:03:53 +00:00
Tom Stellard
d8a0a4cc2b R600: Fix 64-bit integer division
This fixes a failure in one of the oclconform tests.

Patch by: Jan Vesely

llvm-svn: 222073
2014-11-15 01:07:57 +00:00
Tom Stellard
573a5f6172 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.

llvm-svn: 222072
2014-11-15 01:07:53 +00:00
Duncan P. N. Exon Smith
8508167a68 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.

llvm-svn: 222070
2014-11-15 00:23:49 +00:00
Duncan P. N. Exon Smith
323f78513c DIBuilder: Change private helper function to static, NFC
llvm-svn: 222068
2014-11-15 00:05:04 +00:00
Duncan P. N. Exon Smith
52db820492 IR: Remove MDString logic for Value::hasName()
This isn't necessary after r221960.

llvm-svn: 222067
2014-11-14 23:58:20 +00:00
Duncan P. N. Exon Smith
4c98918c51 DIBuilder: Cleanup access control style, NFC
llvm-svn: 222066
2014-11-14 23:55:52 +00:00
Duncan P. N. Exon Smith
500a28518d 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.

llvm-svn: 222064
2014-11-14 23:55:03 +00:00
Reid Kleckner
1bf13cbc83 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

llvm-svn: 222062
2014-11-14 23:31:07 +00:00
Rafael Espindola
c01b31682e 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.

llvm-svn: 222061
2014-11-14 23:17:47 +00:00
Tim Northover
f511e3a633 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.

llvm-svn: 222057
2014-11-14 22:45:33 +00:00
Tim Northover
5eff3fb39c 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.

llvm-svn: 222056
2014-11-14 22:45:31 +00:00
Tim Northover
3327a92a74 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.

llvm-svn: 222055
2014-11-14 22:45:23 +00:00
Eric Christopher
1f2efdb0f1 Rerun AutoRegen.sh.
llvm-svn: 222050
2014-11-14 22:10:16 +00:00
David Blaikie
d0f57445b1 Turn a leaked object into a stack variable instead.
llvm-svn: 222046
2014-11-14 21:53:50 +00:00
Kevin Enderby
a64b36ecab 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.

llvm-svn: 222045
2014-11-14 21:52:18 +00:00
Frederic Riss
1cf11e9eff Add a test for r222029 that doesn't rely on the default target being a COFF platform.
llvm-svn: 222041
2014-11-14 21:23:26 +00:00