OSDN Git Service

android-x86/external-llvm.git
6 years ago[ARM] Fix redirect in inline assembly test
Pablo Barrio [Thu, 15 Feb 2018 19:17:55 +0000 (19:17 +0000)]
[ARM] Fix redirect in inline assembly test

Summary: Fix silly mistake in a test

Reviewers: gkistanova, apilipenko

Subscribers: javed.absar, eraman, kristof.beyls, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325283 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[SCCP] Test that constant propagation updates debug info, NFC
Vedant Kumar [Thu, 15 Feb 2018 19:13:04 +0000 (19:13 +0000)]
[SCCP] Test that constant propagation updates debug info, NFC

This extends an existing test to check that SCCP updates the operands of
relevant dbg.value instructions as it does its work.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325281 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Utils] salvageDI: Add a comment and move a call earlier, NFC
Vedant Kumar [Thu, 15 Feb 2018 19:13:03 +0000 (19:13 +0000)]
[Utils] salvageDI: Add a comment and move a call earlier, NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325280 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Add test cases for opportunities for using BT instead of TEST under optsize.
Craig Topper [Thu, 15 Feb 2018 19:00:11 +0000 (19:00 +0000)]
[X86] Add test cases for opportunities for using BT instead of TEST under optsize.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325277 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoSilence warning about unused private variable.
Zachary Turner [Thu, 15 Feb 2018 18:46:59 +0000 (18:46 +0000)]
Silence warning about unused private variable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325275 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoCall FlushFileBuffers on output files.
Zachary Turner [Thu, 15 Feb 2018 18:36:10 +0000 (18:36 +0000)]
Call FlushFileBuffers on output files.

There is a latent Windows kernel bug, the exact trigger
conditions are not well understood, which can cause a file
to be correctly written, but unable to be correctly read.

The workaround appears to be simply calling FlushFileBuffers.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325274 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WebAssembly] Restore "*-wasm" tests.
Dan Gohman [Thu, 15 Feb 2018 18:05:16 +0000 (18:05 +0000)]
[WebAssembly] Restore "*-wasm" tests.

Even though "...-wasm" is now the default for wasm, it's still
desirable to test this form.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325273 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86][SSE] Add saturated truncation tests for storing illegal v8i8 types
Simon Pilgrim [Thu, 15 Feb 2018 17:48:34 +0000 (17:48 +0000)]
[X86][SSE] Add saturated truncation tests for storing illegal v8i8 types

Tests showing missing opportunities to use PACK instructions in cases where we need to truncate to illegal types for stores

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325270 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRecommit [Hexagon] Make the vararg handling a bit more robust
Krzysztof Parzyszek [Thu, 15 Feb 2018 17:20:07 +0000 (17:20 +0000)]
Recommit [Hexagon] Make the vararg handling a bit more robust

Use the FunctionType of the callee when it's available. It may not be
available for synthetic calls to functions specified by external symbols.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325269 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[SLP] Fix the test for the reversed stores, NFC.
Alexey Bataev [Thu, 15 Feb 2018 17:11:50 +0000 (17:11 +0000)]
[SLP] Fix the test for the reversed stores, NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325268 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agobpf: fix a bug in dag2dag optimization for loads from readonly section
Yonghong Song [Thu, 15 Feb 2018 17:06:45 +0000 (17:06 +0000)]
bpf: fix a bug in dag2dag optimization for loads from readonly section

The reference '&' is missing in the function parameter. If there are
back-to-back optimizations in terms of dag node list like below:
  t29: i64,ch = load<LD4[bitcast (%struct.test_t* @test.t to i8*)+12](dereferenceable), zext from i32> t3, t43, undef:i64
  t34: i64,ch = load<LD4[bitcast (%struct.test_t* @test.t to i8*)](dereferenceable), zext from i32> t3, t41, undef:i64
The bug will trigger a segfault for the added test case remove_truncate_5.ll:
  LLVMSymbolizer: error reading file: No such file or directory
  #0 0x000000000241c4d9 (llc+0x241c4d9)
  #1 0x000000000241c56a (llc+0x241c56a)
  #2 0x000000000241aa50 (llc+0x241aa50)
  ...
  #22 0x0000000000fd5edf (llc+0xfd5edf)
  #23 0x00007f0fe03bec05 __libc_start_main (/lib64/libc.so.6+0x21c05)
  #24 0x0000000000fd3e69 (llc+0xfd3e69)
  ...
  Segmentation fault

Signed-off-by: Yonghong Song <yhs@fb.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325267 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "[Hexagon] Make the vararg handling a bit more robust"
Krzysztof Parzyszek [Thu, 15 Feb 2018 16:57:44 +0000 (16:57 +0000)]
Revert "[Hexagon] Make the vararg handling a bit more robust"

This is breaking lit tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325266 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[SLP] Added test for reversed stores, NFC.
Alexey Bataev [Thu, 15 Feb 2018 16:56:49 +0000 (16:56 +0000)]
[SLP] Added test for reversed stores, NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325265 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] use m_OneUse to reduce code; NFC
Sanjay Patel [Thu, 15 Feb 2018 16:30:10 +0000 (16:30 +0000)]
[InstCombine] use m_OneUse to reduce code; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325263 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] test fdiv folds better; NFC
Sanjay Patel [Thu, 15 Feb 2018 16:28:15 +0000 (16:28 +0000)]
[InstCombine] test fdiv folds better; NFC

We had redundant tests, but no tests for extra uses or vectors.
'fast' is an overly conservative requirement for these folds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325262 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Hexagon] Make the vararg handling a bit more robust
Krzysztof Parzyszek [Thu, 15 Feb 2018 16:24:30 +0000 (16:24 +0000)]
[Hexagon] Make the vararg handling a bit more robust

The FunctionType of the callee is always available, even if the Function
of the callee is not. Use that to get the number of fixed parameters.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325259 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[CodeGen] Separate MBB metadata from instructions in -debug printing
Francis Visoiu Mistrih [Thu, 15 Feb 2018 16:23:59 +0000 (16:23 +0000)]
[CodeGen] Separate MBB metadata from instructions in -debug printing

Add an empty line after 'liveins:', 'successors:', or '; predecessors:',
the one that ends up to be the last one.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325258 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Hexagon] Fix lowering of formal arguments after r324737
Krzysztof Parzyszek [Thu, 15 Feb 2018 15:47:53 +0000 (15:47 +0000)]
[Hexagon] Fix lowering of formal arguments after r324737

Lowering of formal arguments needs to be aware of vararg functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325255 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[SelectionDAG] Pull out repeated Op.getOpcode(). NFCI.
Simon Pilgrim [Thu, 15 Feb 2018 15:31:00 +0000 (15:31 +0000)]
[SelectionDAG] Pull out repeated Op.getOpcode(). NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325253 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[CodeGen] Print irreducible loop header weight as a MIR comment
Francis Visoiu Mistrih [Thu, 15 Feb 2018 15:27:34 +0000 (15:27 +0000)]
[CodeGen] Print irreducible loop header weight as a MIR comment

Prefix it with '; ' to make it more MIR-compatible.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325251 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] allow sin/cos transforms with 'reassoc'
Sanjay Patel [Thu, 15 Feb 2018 15:07:12 +0000 (15:07 +0000)]
[InstCombine] allow sin/cos transforms with 'reassoc'

The variable name 'AllowReassociate' is a lie at this point because
it's set to 'isFast()' which is more than the 'reassoc' FMF after
rL317488.

In D41286, we showed that this transform may be valid even with strict
math by brute force checking every 32-bit float result.

There's a potential problem here because we're replacing with a tan()
libcall rather than a hypothetical LLVM tan intrinsic. So we might
set errno when we should be guaranteed not to do that. But that's
independent of this change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325247 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ARM] Allow 64- and 128-bit types with 't' inline asm constraint
Pablo Barrio [Thu, 15 Feb 2018 14:44:22 +0000 (14:44 +0000)]
[ARM] Allow 64- and 128-bit types with 't' inline asm constraint

Summary:
In LLVM, 't' selects a floating-point/SIMD register and only supports
32-bit values. This is appropriately documented in the LLVM Language
Reference Manual. However, this behaviour diverges from that of GCC, where
't' selects the s0-s31 registers and its qX and dX variants depending on
additional operand modifiers (q/P).

For example, the following C code:

#include <arm_neon.h>
float32x4_t a, b, x;
asm("vadd.f32 %0, %1, %2" : "=t" (x) : "t" (a), "t" (b))

results in the following assembly if compiled with GCC:

vadd.f32 s0, s0, s1

whereas LLVM will show "error: couldn't allocate output register for
constraint 't'", since a, b, x are 128-bit variables, not 32-bit.

This patch extends the use of 't' to mean that of GCC, thus allowing
selection of the lower Q vector regs and their D/S variants. For example,
the earlier code will now compile as:

vadd.f32 q0, q0, q1

This behaviour still differs from that of GCC but I think it is actually
more correct, since LLVM picks up the right register type based on the
datatype of x, while GCC would need an extra operand modifier to achieve
the same result, as follows:

asm("vadd.f32 %q0, %q1, %q2" : "=t" (x) : "t" (a), "t" (b))

Since this is only an extension of functionality, existing code should not
be affected by this change. Note that operand modifiers q/P are already
supported by LLVM, so this patch should suffice to support inline
assembly with constraint 't' originally built for GCC.

Reviewers: grosbach, rengolin

Reviewed By: rengolin

Subscribers: rogfer01, efriedma, olista01, aemerson, javed.absar, eraman, kristof.beyls, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325244 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86][SSE] combineTruncateWithSat - use truncateVectorWithPACK to chain PACKUS vXi32...
Simon Pilgrim [Thu, 15 Feb 2018 14:37:59 +0000 (14:37 +0000)]
[X86][SSE] combineTruncateWithSat - use truncateVectorWithPACK to chain PACKUS vXi32-vXi8 saturated truncation

We can use PACKSS/PACKUS to saturate each stage of the chain: PACKSSDW down to [-32768,32767] and then PACKUSWB to [0,255].

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325243 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] allow X / C -> X * (1.0/C) for vector splat FP constants
Sanjay Patel [Thu, 15 Feb 2018 13:55:52 +0000 (13:55 +0000)]
[InstCombine] allow X / C -> X * (1.0/C) for vector splat FP constants

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325237 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86][SSE] combineTruncateWithSat - use truncateVectorWithPACK to chain PACKSS vXi32...
Simon Pilgrim [Thu, 15 Feb 2018 13:33:15 +0000 (13:33 +0000)]
[X86][SSE] combineTruncateWithSat - use truncateVectorWithPACK to chain PACKSS vXi32-vXi8 saturated truncation

We can use PACKSS to saturate each stage of the chain: PACKSSDW down to [-32768,32767] and then PACKSSWB to [-128,127].

PACKUS is a little trickier and will be handled in a separate patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325235 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[DebugInfo] Accept enumeration types without underlying integer type present in
Momchil Velikov [Thu, 15 Feb 2018 13:29:33 +0000 (13:29 +0000)]
[DebugInfo] Accept enumeration types without underlying integer type present in
debug info metadata

... when generating DWARF.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325234 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[SelectionDAG] Add initial implementation of TargetLowering::SimplifyDemandedVectorElts
Simon Pilgrim [Thu, 15 Feb 2018 12:14:15 +0000 (12:14 +0000)]
[SelectionDAG] Add initial implementation of TargetLowering::SimplifyDemandedVectorElts

This is mainly a move of simplifyShuffleOperands from DAGCombiner::visitVECTOR_SHUFFLE to create a more general purpose TargetLowering::SimplifyDemandedVectorElts implementation.

Further features can be moved/added in future patches.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325232 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ARM] f16 vcmp fixes
Sjoerd Meijer [Thu, 15 Feb 2018 10:33:07 +0000 (10:33 +0000)]
[ARM] f16 vcmp fixes

This adds f16 VCMP match rules and fixes the test cases.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325228 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert r325224 "Report fatal error in the case of out of memory"
Serge Pavlov [Thu, 15 Feb 2018 09:45:59 +0000 (09:45 +0000)]
Revert r325224 "Report fatal error in the case of out of memory"

It caused fails on some buildbots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325227 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoSpecify namespace for realloc
Serge Pavlov [Thu, 15 Feb 2018 09:35:36 +0000 (09:35 +0000)]
Specify namespace for realloc

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325226 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoReport fatal error in the case of out of memory
Serge Pavlov [Thu, 15 Feb 2018 09:20:26 +0000 (09:20 +0000)]
Report fatal error in the case of out of memory

Analysis of fails in the case of out of memory errors can be tricky on
Windows. Such error emerges at the point where memory allocation function
fails, but manifests itself when null pointer is used. These two points
may be distant from each other. Besides, next runs may not exhibit
allocation error.

Usual programming practice does not require checking result of 'operator
new' because it throws 'std::bad_alloc' in the case of allocation error.
However, LLVM is usually built with exceptions turned off, so 'new' can
return null pointer. This change installs custom new handler, which causes
fatal error in the case of out of memory. The handler is installed
automatically prior to call to 'main' during construction of a static
object defined in 'lib/Support/ErrorHandling.cpp'. If the application does
not use this file, the handler may be installed manually by a call to
'llvm::install_out_of_memory_new_handler', declared in
'include/llvm/Support/ErrorHandling.h".

There are calls to C allocation functions, malloc, calloc and realloc.
They are used for interoperability with C code, when allocated object has
variable size and when it is necessary to avoid call of constructors. In
many calls the result is not checked against null pointer. To simplify
checks, new functions are defined in the namespace 'llvm' with the
same names as these C function. These functions produce fatal error if
allocation fails. User should use 'llvm::malloc' instead of 'std::malloc'
in order to use the safe variant. This change replaces 'std::malloc'
in the cases when the result of allocation function is not checked against
null pointer.

Finally, there are plain C code, that uses malloc and similar functions. If
the result is not checked, assert statements are added.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325224 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago(NFC)[MachineCombiner] Improve debug output.
Andrew V. Tischenko [Thu, 15 Feb 2018 07:55:02 +0000 (07:55 +0000)]
(NFC)[MachineCombiner] Improve debug output.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325217 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[NFC] Rename isKnownViaSimpleReasoning to isKnownViaNonRecursiveReasoning
Max Kazantsev [Thu, 15 Feb 2018 07:47:17 +0000 (07:47 +0000)]
[NFC] Rename isKnownViaSimpleReasoning to isKnownViaNonRecursiveReasoning

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325216 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[NFC] Fix metadata placement in test
Max Kazantsev [Thu, 15 Feb 2018 07:13:18 +0000 (07:13 +0000)]
[NFC] Fix metadata placement in test

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325215 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[SCEV] Favor isKnownViaSimpleReasoning over constant ranges check
Max Kazantsev [Thu, 15 Feb 2018 07:09:00 +0000 (07:09 +0000)]
[SCEV] Favor isKnownViaSimpleReasoning over constant ranges check

There is a more powerful but still simple function `isKnownViaSimpleReasoning ` that
does constant range check and few more additional checks. We use it some places (e.g.
when proving implications) and in some other places we only check constant ranges.

Currently, indvar simplifier fails to remove the check in following loop:

  int inc = ...;
  for (int i = inc, j = inc - 1; i < 200; ++i, ++j)
    if (i > j) { ... }

This patch replaces all usages of `isKnownPredicateViaConstantRanges` with
`isKnownViaSimpleReasoning` to have smarter proofs. In particular, it fixes the
case above.

Reviewed-By: sanjoy
Differential Revision: https://reviews.llvm.org/D43175

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325214 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Regnerate test to show scheduling comments. NFC
Craig Topper [Thu, 15 Feb 2018 02:14:20 +0000 (02:14 +0000)]
[X86] Regnerate test to show scheduling comments. NFC

These must have not been printing the last time the test was re-generated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325198 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Change 32 and 64 bit versions of LSL instruction have a 16-bit memory operand.
Craig Topper [Thu, 15 Feb 2018 01:21:53 +0000 (01:21 +0000)]
[X86] Change 32 and 64 bit versions of LSL instruction have a 16-bit memory operand.

This matches the Intel and AMD documentation and is consistent with the LAR instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325197 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Dont' allow 'outs' and 'ins' in at&t syntax without suffixes.
Craig Topper [Wed, 14 Feb 2018 23:53:26 +0000 (23:53 +0000)]
[X86] Dont' allow 'outs' and 'ins' in at&t syntax without suffixes.

The match would be ambiguous, but at&t asm parsing doesn't support ambiguous matches and will just return the first.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325192 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Don't use 64 bit hex constants in a 32 bit assembler test.
Craig Topper [Wed, 14 Feb 2018 23:53:24 +0000 (23:53 +0000)]
[X86] Don't use 64 bit hex constants in a 32 bit assembler test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325191 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Reverse the operand order of invlpga in at&t syntax to match gas.
Craig Topper [Wed, 14 Feb 2018 23:53:21 +0000 (23:53 +0000)]
[X86] Reverse the operand order of invlpga in at&t syntax to match gas.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325190 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[llvm-objcopy] Fix handling of zero-size segments in llvm-objcopy
Jake Ehrlich [Wed, 14 Feb 2018 23:31:33 +0000 (23:31 +0000)]
[llvm-objcopy] Fix handling of zero-size segments in llvm-objcopy

Some ELF files produced by lld may have zero-size segment placeholders as shown
below. Since GNU_STACK Offset is 0, the current code makes it the lowest used
offset, and relocates all the segments over the ELF header. The resulting
binary is total garbage.

This change fixes how llvm-objcopy handles PT_PHDR properlly by treating ELF
headers and the program header table as segments to allow the layout algorithm
decide where those should go.

Author: vit9696

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325189 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] clean up fold for X / C -> X * (1.0/C); NFCI
Sanjay Patel [Wed, 14 Feb 2018 23:04:17 +0000 (23:04 +0000)]
[InstCombine] clean up fold for X / C -> X * (1.0/C); NFCI

This should work with vector constants too, but it's currently limited to scalar.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325187 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ThinLTO/CFI] Include TYPE_ID summaries into GLOBALVAL_SUMMARY_BLOCK
Vitaly Buka [Wed, 14 Feb 2018 22:41:15 +0000 (22:41 +0000)]
[ThinLTO/CFI] Include TYPE_ID summaries into GLOBALVAL_SUMMARY_BLOCK

Summary:
TypeID summaries are used by CFI and need to be serialized by ThinLTO
indexing for later use by LTO Backend.

Reviewers: tejohnson, pcc

Subscribers: mehdi_amini, inglorion, eraman, hiraditya, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325182 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ORC] Consolidate RTDyldObjectLinkingLayer GetMemMgr and GetResolver into a
Lang Hames [Wed, 14 Feb 2018 22:13:02 +0000 (22:13 +0000)]
[ORC] Consolidate RTDyldObjectLinkingLayer GetMemMgr and GetResolver into a
unified GetResources callback.

Having a single 'GetResources' callback will simplify adding new resources in
the future.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325180 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ORC] Switch to shared_ptr ownership for AsynchronousSymbolQueries.
Lang Hames [Wed, 14 Feb 2018 22:12:56 +0000 (22:12 +0000)]
[ORC] Switch to shared_ptr ownership for AsynchronousSymbolQueries.

Queries need to stay alive until each owner has set the values they are
responsible for.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325179 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Don't swap argument on BOUND instruction in at&t syntax.
Craig Topper [Wed, 14 Feb 2018 21:54:58 +0000 (21:54 +0000)]
[X86] Don't swap argument on BOUND instruction in at&t syntax.

The bound instruction does not have reversed operands in gas.

Fixes PR27653.

Patch by Maya Madhavan.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325178 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoChange the BugDriver to store the current module with std::unique_ptr.
Rafael Espindola [Wed, 14 Feb 2018 21:44:34 +0000 (21:44 +0000)]
Change the BugDriver to store the current module with std::unique_ptr.

While there, change a bunch of helper functions to take references to
avoid adding calls to get().

This should conclude the bugpoint yak shaving.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325177 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoUse std::uniue_ptr. NFC.
Rafael Espindola [Wed, 14 Feb 2018 21:25:07 +0000 (21:25 +0000)]
Use std::uniue_ptr. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325176 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoUse std::unique_ptr. NFC.
Rafael Espindola [Wed, 14 Feb 2018 21:17:36 +0000 (21:17 +0000)]
Use std::unique_ptr. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325174 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoUse std::unique_ptr. NFC.
Rafael Espindola [Wed, 14 Feb 2018 21:10:29 +0000 (21:10 +0000)]
Use std::unique_ptr. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325173 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoUse std::unique_ptr. NFC.
Rafael Espindola [Wed, 14 Feb 2018 20:59:39 +0000 (20:59 +0000)]
Use std::unique_ptr. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325172 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoUse std::unique_ptr. NFC.
Rafael Espindola [Wed, 14 Feb 2018 20:53:38 +0000 (20:53 +0000)]
Use std::unique_ptr. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325170 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Hexagon] Split HVX vector pair loads/stores, expand unaligned loads
Krzysztof Parzyszek [Wed, 14 Feb 2018 20:46:06 +0000 (20:46 +0000)]
[Hexagon] Split HVX vector pair loads/stores, expand unaligned loads

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325169 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRemoved superfluous semicolon to fix -Wpedantic gcc warning. NFCI.
Simon Pilgrim [Wed, 14 Feb 2018 20:43:47 +0000 (20:43 +0000)]
Removed superfluous semicolon to fix -Wpedantic gcc warning. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325168 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoUse std::unique_ptr. NFC.
Rafael Espindola [Wed, 14 Feb 2018 20:25:18 +0000 (20:25 +0000)]
Use std::unique_ptr. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325167 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[CodeGen] Print predecessors, successors, then liveins in -debug printing
Francis Visoiu Mistrih [Wed, 14 Feb 2018 20:23:05 +0000 (20:23 +0000)]
[CodeGen] Print predecessors, successors, then liveins in -debug printing

Reorder them to match MIR.

Predecessors are only comments, and they're not usually printed in MIR.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325166 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoUse std::unique_ptr. NFC.
Rafael Espindola [Wed, 14 Feb 2018 20:21:20 +0000 (20:21 +0000)]
Use std::unique_ptr. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325165 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoUse std::unique_ptr. NFC.
Rafael Espindola [Wed, 14 Feb 2018 20:13:01 +0000 (20:13 +0000)]
Use std::unique_ptr. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325164 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoUse std::unique_ptr. NFC.
Rafael Espindola [Wed, 14 Feb 2018 19:58:41 +0000 (19:58 +0000)]
Use std::unique_ptr. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325163 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoGlobalISel: Add templated functions and pattern matcher support for some more opcodes
Volkan Keles [Wed, 14 Feb 2018 19:58:36 +0000 (19:58 +0000)]
GlobalISel: Add templated functions and pattern matcher support for some more opcodes

Summary:
This patch adds templated functions to MachineIRBuilder for some opcodes
and adds pattern matcher support for G_AND and G_OR.

Reviewers: aditya_nandakumar

Reviewed By: aditya_nandakumar

Subscribers: rovka, kristof.beyls, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325162 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] add tests and comments for fdiv X, C; NFC
Sanjay Patel [Wed, 14 Feb 2018 19:54:51 +0000 (19:54 +0000)]
[InstCombine] add tests and comments for fdiv X, C; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325161 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoPass a module reference to CloneModule.
Rafael Espindola [Wed, 14 Feb 2018 19:50:40 +0000 (19:50 +0000)]
Pass a module reference to CloneModule.

It can never be null and most callers were already using references or
std::unique_ptr.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325160 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoUpdate examples for API change. NFC.
Rafael Espindola [Wed, 14 Feb 2018 19:23:27 +0000 (19:23 +0000)]
Update examples for API change. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325157 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoPass a reference to a module to the bitcode writer.
Rafael Espindola [Wed, 14 Feb 2018 19:11:32 +0000 (19:11 +0000)]
Pass a reference to a module to the bitcode writer.

This simplifies most callers as they are already using references or
std::unique_ptr.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325155 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[RegisterClassInfo] Invalidate the register pressure set limit cache when reserved...
Craig Topper [Wed, 14 Feb 2018 18:53:29 +0000 (18:53 +0000)]
[RegisterClassInfo] Invalidate the register pressure set limit cache when reserved regs or callee saved regs change

Previously we only invalidated the pressure set limit cached when the TargetRegisterInfo pointer changes. But as reserved regs and callee saved regs are used as part of calculating the limits we should invalidate when those change too.

I encountered this when reverting a patch from the 6.0 branch. One of the x86 test files had a function that used rbp as a frame pointer, making it reserved. It was followed by another function which didn't use rbp but had the same TRI so the pressure set limit cache was not invalidated. If i removed the function that used rbp as a frame pointer from the file, the remaining function then got a different register pressure limit for the GR16 pressure set. This caused the machine scheduler to change the scheduling for the function. This was an unexpected change from just deleting a function.

I don't have a test case for trunk because the particular x86 test case is different enough from the 6.0 branch to not be affected now.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325153 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoMove llvm::computeLoopSafetyInfo from LICM.cpp to LoopUtils.cpp. NFC
David Green [Wed, 14 Feb 2018 18:34:53 +0000 (18:34 +0000)]
Move llvm::computeLoopSafetyInfo from LICM.cpp to LoopUtils.cpp. NFC

Move computeLoopSafetyInfo, defined in Transforms/Utils/LoopUtils.h,
into the corresponding LoopUtils.cpp, as opposed to LICM where it resides
at the moment. This will allow other functions from Transforms/Utils
to reference it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325151 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86][SSE] truncateVectorWithPACK - Use src type instead of dst to select between...
Simon Pilgrim [Wed, 14 Feb 2018 18:23:58 +0000 (18:23 +0000)]
[X86][SSE] truncateVectorWithPACK - Use src type instead of dst to select between PACK*SDW/PACK*SWB

Try to keep PACK*SDW/PACK*SWB as wide as possible, this helps ComputeNumSignBits as it can only peek through bitcasts to wider types, pre-AVX2 codegen was already doing this as it could peek through bitcasts/subvectors more easily than AVX2 could through shuffles.

This shouldn't affect existing results as calls to truncateVectorWithPACK ensure we have enough sign bits to pack to the same value, but it should make it possible to use truncateVectorWithPACK chains to perform saturation in combineTruncateWithSat with a future patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325149 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Don't fold select(C, Z, binop(select(C, X, Y), W)) -> select(C, Z,...
Craig Topper [Wed, 14 Feb 2018 18:08:33 +0000 (18:08 +0000)]
[InstCombine] Don't fold select(C, Z, binop(select(C, X, Y), W)) -> select(C, Z, binop(Y, W)) if the binop is rem or div.

The select may have been preventing a division by zero or INT_MIN/-1 so removing it might not be safe.

Fixes PR36362.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325148 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AMDGPU] Remove non-temporal flag from argument loads
Stanislav Mekhanoshin [Wed, 14 Feb 2018 18:05:14 +0000 (18:05 +0000)]
[AMDGPU] Remove non-temporal flag from argument loads

Kernel arguments likely read by all workitems and should not bypass
cache. Fixes performance hit in sub-dword argument loads.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325146 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] regenerate checks; NFC
Sanjay Patel [Wed, 14 Feb 2018 17:37:32 +0000 (17:37 +0000)]
[InstCombine] regenerate checks; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325144 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[DWARF] Fix incorrect prologue end line record.
Paul Robinson [Wed, 14 Feb 2018 17:35:52 +0000 (17:35 +0000)]
[DWARF] Fix incorrect prologue end line record.

The prologue-end line record must be emitted after the last
instruction that is part of the function frame setup code and before
the instruction that marks the beginning of the function body.

Patch by Carlos Alberto Enciso!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325143 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] simplify isFMulOrFDivWithConstant(); NFCI
Sanjay Patel [Wed, 14 Feb 2018 17:16:33 +0000 (17:16 +0000)]
[InstCombine] simplify isFMulOrFDivWithConstant(); NFCI

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325142 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] replace isa/cast with dyn_cast; NFC
Sanjay Patel [Wed, 14 Feb 2018 16:56:44 +0000 (16:56 +0000)]
[InstCombine] replace isa/cast with dyn_cast; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325141 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] refactor folds for mul with negated operands; NFCI
Sanjay Patel [Wed, 14 Feb 2018 16:50:55 +0000 (16:50 +0000)]
[InstCombine] refactor folds for mul with negated operands; NFCI

This keeps with our current usage of 'match' and is easier to see that
the optional NSW only applies in the non-constant operand case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325140 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoStore defined macros in MCContext.
Rafael Espindola [Wed, 14 Feb 2018 16:34:27 +0000 (16:34 +0000)]
Store defined macros in MCContext.

So that macros defined in inline assembly blocks are available to the
whole file.

This provides a consistent behavior with other assembly directives,
since equations for example are already preserved between inline
assembly blocks.

PR: 36110

Patch by Roger!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325139 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[x86] add baseline vector compare tests for D42948; NFC
Sanjay Patel [Wed, 14 Feb 2018 16:15:15 +0000 (16:15 +0000)]
[x86] add baseline vector compare tests for D42948; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325138 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[SelectionDAG][X86] Fix incorrect offset generated for VMASKMOV
Alexander Ivchenko [Wed, 14 Feb 2018 15:55:24 +0000 (15:55 +0000)]
[SelectionDAG][X86] Fix incorrect offset generated for VMASKMOV

When creating high MachineMemOperand for MSTORE/MLOAD we supply
it with the original PointerInfo, while the pointer itself had been incremented.
The patch adds the proper offset to the PointerInfo.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325135 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[SLP] Allow vectorization of reversed loads.
Alexey Bataev [Wed, 14 Feb 2018 15:29:15 +0000 (15:29 +0000)]
[SLP] Allow vectorization of reversed loads.

Summary:
Reversed loads are handled as gathering. But we can just reshuffle
these values. Patch adds support for vectorization of reversed loads.

Reviewers: RKSimon, spatel, mkuper, hfinkel

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325134 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ARM] f16 stack spill/reloads
Sjoerd Meijer [Wed, 14 Feb 2018 15:09:09 +0000 (15:09 +0000)]
[ARM] f16 stack spill/reloads

This adds support for handling f16 stack spills/reloads.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325130 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix GCC -Wlogical-op-parentheses warning. NFCI.
Simon Pilgrim [Wed, 14 Feb 2018 15:07:36 +0000 (15:07 +0000)]
Fix GCC -Wlogical-op-parentheses warning. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325129 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Reduce Store Forward Block issues in HW - Recommit after fixing Bug 36346
Lama Saba [Wed, 14 Feb 2018 14:58:53 +0000 (14:58 +0000)]
[X86] Reduce Store Forward Block issues in HW - Recommit after fixing Bug 36346

If a load follows a store and reloads data that the store has written to memory, Intel microarchitectures can in many cases forward the data directly from the store to the load, This "store forwarding" saves cycles by enabling the load to directly obtain the data instead of accessing the data from cache or memory.
A "store forward block" occurs in cases that a store cannot be forwarded to the load. The most typical case of store forward block on Intel Core microarchiticutre that a small store cannot be forwarded to a large load.
The estimated penalty for a store forward block is ~13 cycles.

This pass tries to recognize and handle cases where "store forward block" is created by the compiler when lowering memcpy calls to a sequence
of a load and a store.

The pass currently only handles cases where memcpy is lowered to XMM/YMM registers, it tries to break the memcpy into smaller copies.
breaking the memcpy should be possible since there is no atomicity guarantee for loads and stores to XMM/YMM.

Change-Id: Ic41aa9ade6512e0478db66e07e2fde41b4fb35f9

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325128 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86][SSE] Relax type legality for combineTruncateWithSat PACKSS/PACKUS truncation
Simon Pilgrim [Wed, 14 Feb 2018 14:14:29 +0000 (14:14 +0000)]
[X86][SSE] Relax type legality for combineTruncateWithSat PACKSS/PACKUS truncation

While the AVX512 VTRUNCS/VTRUNCUS instructions require legal types, truncateVectorWithPACK handles cases with multiples of legal types through splitting/concatenation. So we just need to ensure that the src/dst scalar types are correct and leave truncateVectorWithPACK to handle the rest of it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325127 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRecommit r325001: [CallSiteSplitting] Support splitting of blocks with instrs before...
Florian Hahn [Wed, 14 Feb 2018 13:59:12 +0000 (13:59 +0000)]
Recommit r325001: [CallSiteSplitting] Support splitting of blocks with instrs before call.

For basic blocks with instructions between the beginning of the block
and a call we have to duplicate the instructions before the call in all
split blocks and add PHI nodes for uses of the duplicated instructions
after the call.

Currently, the threshold for the number of instructions before a call
is quite low, to keep the impact on binary size low.

Reviewers: junbuml, mcrosier, davidxl, davide

Reviewed By: junbuml

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325126 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[LoopInterchange] Incrementally update the dominator tree.
Florian Hahn [Wed, 14 Feb 2018 13:13:15 +0000 (13:13 +0000)]
[LoopInterchange] Incrementally update the dominator tree.

We can use incremental dominator tree updates to avoid re-calculating
the dominator tree after interchanging 2 loops.

Reviewers: dmgreen, kuhar

Reviewed By: kuhar

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325122 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoUse EXPECT_FALSE instead of EXPECT_EQ(false, ...
Momchil Velikov [Wed, 14 Feb 2018 13:11:56 +0000 (13:11 +0000)]
Use EXPECT_FALSE instead of EXPECT_EQ(false, ...

Commit https://reviews.llvm.org/rL324489 added

    EXPECT_EQ(false, N->isUnsigned());

which older GCC versions dislike for some reason. Anyway, it looks like the
proper GTest way is to use EXPECT_FALSE, etc.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325121 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Utils] Salvage the debug info of DCE'ed 'and' instructions
Petar Jovanovic [Wed, 14 Feb 2018 13:10:35 +0000 (13:10 +0000)]
[Utils] Salvage the debug info of DCE'ed 'and' instructions

Preserve debug info from a dead 'and' instruction with a constant.

Patch by Djordje Todorovic.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325119 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert r325107 (case folding DJB hash) and subsequent build fix
Pavel Labath [Wed, 14 Feb 2018 11:06:39 +0000 (11:06 +0000)]
Revert r325107 (case folding DJB hash) and subsequent build fix

The "knownValuesUnicode" test in the patch fails on ppc64 and arm64
bots. Reverting while I investigate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325115 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[IRMover] Move type name extraction to a separate function. NFC
Eugene Leviant [Wed, 14 Feb 2018 10:32:47 +0000 (10:32 +0000)]
[IRMover] Move type name extraction to a separate function. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325110 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix build broken by r325107
Pavel Labath [Wed, 14 Feb 2018 10:25:32 +0000 (10:25 +0000)]
Fix build broken by r325107

Older gcc versions need an extra pair of {}s to convert a string literal
into llvm::StringLiteral.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325109 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoImplement a case-folding version of DJB hash
Pavel Labath [Wed, 14 Feb 2018 10:05:09 +0000 (10:05 +0000)]
Implement a case-folding version of DJB hash

Summary:
This patch implements a variant of the DJB hash function which folds the
input according to the algorithm in the Dwarf 5 specification (Section
6.1.1.4.5), which in turn references the Unicode Standard (Section 5.18,
"Case Mappings").

To achieve this, I have added a llvm::sys::unicode::foldCharSimple
function, which performs this mapping. The implementation of this
function was generated from the CaseMatching.txt file from the Unicode
spec using a python script (which is also included in this patch). The
script tries to optimize the function by coalescing adjecant mappings
with the same shift and stride (terms I made up). Theoretically, it
could be made a bit smarter and merge adjecant blocks that were
interrupted by only one or two characters with exceptional mapping, but
this would save only a couple of branches, while it would greatly
complicate the implementation, so I deemed it was not worth it.

Since we assume that the vast majority of the input characters will be
US-ASCII, the folding hash function has a fast-path for handling these,
and only whips out the full decode+fold+encode logic if we encounter a
character outside of this range. It might be possible to implement the
folding directly on utf8 sequences, but this would also bring a lot of
complexity for the few cases where we will actually need to process
non-ascii characters.

Reviewers: JDevlieghere, aprantl, probinson, dblaikie

Subscribers: mgorny, hintonda, echristo, clayborg, vleschuk, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325107 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAdding a width of the GEP index to the Data Layout.
Elena Demikhovsky [Wed, 14 Feb 2018 06:58:08 +0000 (06:58 +0000)]
Adding a width of the GEP index to the Data Layout.

Making a width of GEP Index, which is used for address calculation, to be one of the pointer properties in the Data Layout.
p[address space]:size:memory_size:alignment:pref_alignment:index_size_in_bits.
The index size parameter is optional, if not specified, it is equal to the pointer size.

Till now, the InstCombiner normalized GEPs and extended the Index operand to the pointer width.
It works fine if you can convert pointer to integer for address calculation and all registered targets do this.
But some ISAs have very restricted instruction set for the pointer calculation. During discussions were desided to retrieve information for GEP index from the Data Layout.
http://lists.llvm.org/pipermail/llvm-dev/2018-January/120416.html

I added an interface to the Data Layout and I changed the InstCombiner and some other passes to take the Index width into account.
This change does not affect any in-tree target. I added tests to cover data layouts with explicitly specified index size.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325102 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[SelectionDAG] Remove duplicate code from TargetLowering::SimplifySetCC.
Craig Topper [Wed, 14 Feb 2018 06:51:57 +0000 (06:51 +0000)]
[SelectionDAG] Remove duplicate code from TargetLowering::SimplifySetCC.

This exact code already exists a little further up.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325101 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoUse delete[] instead of free
Serge Pavlov [Wed, 14 Feb 2018 06:14:30 +0000 (06:14 +0000)]
Use delete[] instead of free

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325100 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoUse delete[] to deallocate array of chars
Serge Pavlov [Wed, 14 Feb 2018 05:14:31 +0000 (05:14 +0000)]
Use delete[] to deallocate array of chars

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325099 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRefactor DisassembleInfo in MachODump.cpp
Serge Pavlov [Wed, 14 Feb 2018 03:26:27 +0000 (03:26 +0000)]
Refactor DisassembleInfo in MachODump.cpp

The change implements constructor of DisassembleInfo to avoid duplication
of initialization code and gets rid of malloc/free where possible.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325098 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Remove dead code from retpoline thunk generation
Reid Kleckner [Wed, 14 Feb 2018 00:24:29 +0000 (00:24 +0000)]
[X86] Remove dead code from retpoline thunk generation

Follow-up to r325049

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325085 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[gold] Fix error report in thinlto_emit_linked_objects.ll test
Vitaly Buka [Wed, 14 Feb 2018 00:00:43 +0000 (00:00 +0000)]
[gold] Fix error report in thinlto_emit_linked_objects.ll test

Summary:
It's just cleanup after r323818 to avoid irrelevant error message inside the test.
Existing version of test passed but generated unrelated error report about
symbol redefinition.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325080 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix off-by-one in set_thread_name which causes truncation to fail on Linux
Sam McCall [Tue, 13 Feb 2018 23:23:59 +0000 (23:23 +0000)]
Fix off-by-one in set_thread_name which causes truncation to fail on Linux

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325069 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[globalisel][legalizerinfo] Follow up on post-commit review comments after r323681
Daniel Sanders [Tue, 13 Feb 2018 23:02:44 +0000 (23:02 +0000)]
[globalisel][legalizerinfo] Follow up on post-commit review comments after r323681

* Document most API's
* Delete a useless function call
* Fix a discrepancy between the single and multi-opcode variants of
  getActionDefinitions().
  The multi-opcode variant now requires that more than one opcode is requested.
  Previously it acted much like the single-opcode form but unnecessarily
  enforced the requirements of the multi-opcode form.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325067 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] put tests of mul with neg operand(s) together; NFC
Sanjay Patel [Tue, 13 Feb 2018 23:02:12 +0000 (23:02 +0000)]
[InstCombine] put tests of mul with neg operand(s) together; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325066 91177308-0d34-0410-b5e6-96231b3b80d8