OSDN Git Service

android-x86/external-llvm.git
6 years agobpf: New codegen testcases for 32-bit subregister support
Yonghong Song [Fri, 23 Feb 2018 23:49:33 +0000 (23:49 +0000)]
bpf: New codegen testcases for 32-bit subregister support

This patch adds some unit tests for 32-bit subregister support.
We want to make sure ALU32, subregister load/store and new peephole
optimization are truely enabled once -mattr=+alu32 specified.

Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Yonghong Song <yhs@fb.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325992 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agobpf: New optimization pass for eliminating unnecessary i32 promotions
Yonghong Song [Fri, 23 Feb 2018 23:49:32 +0000 (23:49 +0000)]
bpf: New optimization pass for eliminating unnecessary i32 promotions

This pass performs peephole optimizations to cleanup ugly code sequences at
MachineInstruction layer.

Currently, the only optimization in this pass is to eliminate type
promotion
sequences for zero extending 32-bit subregisters to 64-bit registers.

If the compiler could prove the zero extended source come from 32-bit
subregistere then it is safe to erase those promotion sequece, because the
upper half of the underlying 64-bit registers were zeroed implicitly
already.

Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Yonghong Song <yhs@fb.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325991 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agobpf: New decoder namespace for 32-bit subregister load/store
Yonghong Song [Fri, 23 Feb 2018 23:49:31 +0000 (23:49 +0000)]
bpf: New decoder namespace for 32-bit subregister load/store

When -mattr=+alu32 passed to the disassembler, use decoder namespace for
32-bit subregister.

This is to disassemble load and store instructions in preferred B format
as described in previous commit:

      w = *(u8 *) (r + off) // BPF_LDX | BPF_B
      w = *(u16 *)(r + off) // BPF_LDX | BPF_H
      w = *(u32 *)(r + off) // BPF_LDX | BPF_W

      *(u8 *) (r + off) = w // BPF_STX | BPF_B
      *(u16 *)(r + off) = w // BPF_STX | BPF_H
      *(u32 *)(r + off) = w // BPF_STX | BPF_W

NOTE: all other instructions should still use the default decoder
      namespace.

Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Yonghong Song <yhs@fb.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325990 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agobpf: Enable 32-bit subregister support for -mattr=+alu32
Yonghong Song [Fri, 23 Feb 2018 23:49:30 +0000 (23:49 +0000)]
bpf: Enable 32-bit subregister support for -mattr=+alu32

After all those preparation patches, now we could enable 32-bit subregister
support once -mattr=+alu32 specified.

Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Yonghong Song <yhs@fb.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325989 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agobpf: Support 32-bit subregister in various InstrInfo hooks
Yonghong Song [Fri, 23 Feb 2018 23:49:29 +0000 (23:49 +0000)]
bpf: Support 32-bit subregister in various InstrInfo hooks

This patch support 32-bit subregister in three InstrInfo hooks, i.e.
copyPhysReg, loadRegFromStackSlot and storeRegToStackSlot,

Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Yonghong Song <yhs@fb.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325988 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agobpf: New instruction patterns for 32-bit subregister load and store
Yonghong Song [Fri, 23 Feb 2018 23:49:28 +0000 (23:49 +0000)]
bpf: New instruction patterns for 32-bit subregister load and store

The instruction mapping between eBPF/arm64/x86_64 are:

         eBPF              arm64        x86_64
LD1   BPF_LDX | BPF_B       ldrb        movzbl
LD2   BPF_LDX | BPF_H       ldrh        movzwl
LD4   BPF_LDX | BPF_W       ldr         movl

movzbl/movzwl/movl on x86_64 accept 32-bit sub-register, for example %eax,
the same for ldrb/ldrh on arm64 which accept 32-bit "w" register. And
actually these instructions only accept sub-registers. There is no point
to have LD1/2/4 (unsigned) for 64-bit register, because on these arches,
upper 32-bits are guaranteed to be zeroed by hardware or VM, so load into
the smallest available register class is the best choice for maintaining
type information.

For eBPF we should adopt the same philosophy, to change current
format (A):

  r = *(u8 *) (r + off) // BPF_LDX | BPF_B
  r = *(u16 *)(r + off) // BPF_LDX | BPF_H
  r = *(u32 *)(r + off) // BPF_LDX | BPF_W

  *(u8 *) (r + off) = r // BPF_STX | BPF_B
  *(u16 *)(r + off) = r // BPF_STX | BPF_H
  *(u32 *)(r + off) = r // BPF_STX | BPF_W

into B:

  w = *(u8 *) (r + off) // BPF_LDX | BPF_B
  w = *(u16 *)(r + off) // BPF_LDX | BPF_H
  w = *(u32 *)(r + off) // BPF_LDX | BPF_W

  *(u8 *) (r + off) = w // BPF_STX | BPF_B
  *(u16 *)(r + off) = w // BPF_STX | BPF_H
  *(u32 *)(r + off) = w // BPF_STX | BPF_W

There is no change on encoding nor how should they be interpreted,
everything is as it is, load the specified length, write into low bits of
the register then zeroing all remaining high bits.

The only change is their associated register class and how compiler view
them.

Format A still need to be kept, because eBPF LLVM backend doesn't support
sub-registers at default, but once 32-bit subregister is enabled, it should
use format B.

This patch implemented this together with all those necessary extended load
and truncated store patterns.

Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Yonghong Song <yhs@fb.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325987 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agobpf: Support i32 in getScalarShiftAmountTy method
Yonghong Song [Fri, 23 Feb 2018 23:49:26 +0000 (23:49 +0000)]
bpf: Support i32 in getScalarShiftAmountTy method

getScalarShiftAmount method should be implemented for eBPF backend to make
sure shift amount could still get correct type once 32-bit subregisters
support are enabled.

Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Yonghong Song <yhs@fb.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325986 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agobpf: Support condition comparison on i32
Yonghong Song [Fri, 23 Feb 2018 23:49:25 +0000 (23:49 +0000)]
bpf: Support condition comparison on i32

We need to support condition comparison on i32. All these comparisons are
supposed to be combined into BPF_J* instructions which only support i64.

For ISD::BR_CC we need to promote it to i64 first, then do custom lowering.

For ISD::SET_CC, just expand to SELECT_CC like what's been done for i64.

For ISD::SELECT_CC, we also want to do custom lower for i32. However, after
32-bit subregister support enabled, it is possible the comparison operands
are i32 while the selected value are i64, or the comparison operands are
i64 while the selected value are i32. We need to define extra instruction
pattern and support them in custom instruction inserter.

Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Yonghong Song <yhs@fb.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325985 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agobpf: Handle i32 for ALU operations without ISA support
Yonghong Song [Fri, 23 Feb 2018 23:49:24 +0000 (23:49 +0000)]
bpf: Handle i32 for ALU operations without ISA support

There is no eBPF ISA support for BSWAP, ROTR, ROTL, SREM, SDIVREM, MULHU,
ADDC, ADDE etc on i32.

They could be emulated by other basic BPF_ALU operations, we'd set their
lowering action the same as i64.

Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Yonghong Song <yhs@fb.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325984 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agobpf: New calling convention for 32-bit subregisters
Yonghong Song [Fri, 23 Feb 2018 23:49:23 +0000 (23:49 +0000)]
bpf: New calling convention for 32-bit subregisters

This patch add new calling conventions to allow GPR32RegClass as valid
register class for arguments and return types.

New calling convention will only be choosen when -mattr=+alu32 specified.

Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Yonghong Song <yhs@fb.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325983 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agobpf: New target attribute "alu32" for 32-bit subregister support
Yonghong Song [Fri, 23 Feb 2018 23:49:22 +0000 (23:49 +0000)]
bpf: New target attribute "alu32" for 32-bit subregister support

This new attribute aims to control the enablement of 32-bit subregister
support on eBPF backend.

Name the interface as "alu32" is because we in particular want to enable
the generation of BPF_ALU32 instructions by enable subregister support.

This attribute could be used in the following format with llc:

  llc -mtriple=bpf -mattr=[+|-]alu32

It is disabled at default.

Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Yonghong Song <yhs@fb.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325982 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agobpf: Define instruction patterns for extensions and truncations between i32 to i64
Yonghong Song [Fri, 23 Feb 2018 23:49:21 +0000 (23:49 +0000)]
bpf: Define instruction patterns for extensions and truncations between i32 to i64

For transformations between i32 and i64, if it is explicit signed extension:
  - first cast the operand to i64
  - then use SLL + SRA to finish the extension.

if it is explicit zero extension:
  - first cast the operand to i64
  - then use SLL + SRL to finish the extension.

if it is explicit any extension:
  - just refer to 64-bit register.

if it is explicit truncation:
  - just refer to 32-bit subregister.

NOTE: Some of the zero extension sequences might be unnecessary, they will be
removed by an peephole pass on MachineInstruction layer.

Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Yonghong Song <yhs@fb.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325981 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agobpf: Tighten the immediate predication for 32-bit alu instructions
Yonghong Song [Fri, 23 Feb 2018 23:49:19 +0000 (23:49 +0000)]
bpf: Tighten the immediate predication for 32-bit alu instructions

These 32-bit ALU insn patterns which takes immediate as one operand were
initially added to enable AsmParser support, and the AsmMatcher uses "ins"
and "outs" fields to deduct the operand constraint.

However, the instruction selector doesn't work the same as AsmMatcher. The
selector will use the "pattern" field for which we are not setting the
predication for immediate operands correctly.

Without this patch, i32 would eventually means all i32 operands are valid,
both imm and gpr, while these patterns should allow imm only.

Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Yonghong Song <yhs@fb.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325980 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agobpf: Use markSuperRegs to mark reserved registers
Yonghong Song [Fri, 23 Feb 2018 23:49:18 +0000 (23:49 +0000)]
bpf: Use markSuperRegs to mark reserved registers

markSuperRegs is the canonical helper function used to mark reserved
registers. It could mark any overlapping sub-registers automatically.

Reviewed-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325979 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[DebugInfo] Add remaining files to r325970
Scott Linder [Fri, 23 Feb 2018 23:13:18 +0000 (23:13 +0000)]
[DebugInfo] Add remaining files to r325970

Add files which I missed in the original check-in

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

6 years ago[PowerPC] Disable shrink-wrapping when getting PC address through the LR
Nemanja Ivanovic [Fri, 23 Feb 2018 23:08:34 +0000 (23:08 +0000)]
[PowerPC] Disable shrink-wrapping when getting PC address through the LR

The instruction sequence used to get the address of the PC into a GPR requires
that we clobber the link register. Doing so without having first saved it in
the prologue leaves the function unable to return. Currently, this sequence is
emitted into the entry block. To ensure the prologue is inserted before this
sequence, disable shrink-wrapping.

This fixes PR33547.

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

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

6 years ago[MemorySSA] Fix a cache invalidation bug with removed accesses
George Burgess IV [Fri, 23 Feb 2018 23:07:18 +0000 (23:07 +0000)]
[MemorySSA] Fix a cache invalidation bug with removed accesses

I suspect there's a deeper issue here, but we probably shouldn't be
using INVALID_MEMORYSSA_ID as liveOnEntry's ID anyway.

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

6 years ago[DebugInfo] Support DWARF v5 source code embedding extension
Scott Linder [Fri, 23 Feb 2018 23:01:06 +0000 (23:01 +0000)]
[DebugInfo] Support DWARF v5 source code embedding extension

In DWARF v5 the Line Number Program Header is extensible, allowing values with
new content types. In this extension a content type is added,
DW_LNCT_LLVM_source, which contains the embedded source code of the file.

Add new optional attribute for !DIFile IR metadata called source which contains
source text. Use this to output the source to the DWARF line table of code
objects. Analogously extend METADATA_FILE in Bitcode and .file directive in ASM
to support optional source.

Teach llvm-dwarfdump and llvm-objdump about the new values. Update the output
format of llvm-dwarfdump to make room for the new attribute on file_names
entries, and support embedded sources for the -source option in llvm-objdump.

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

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

6 years ago[InstCombine] simplify code for fabs(X) * fabs(X) -> X * X; NFC
Sanjay Patel [Fri, 23 Feb 2018 22:38:10 +0000 (22:38 +0000)]
[InstCombine] simplify code for fabs(X) * fabs(X) -> X * X; NFC

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

6 years agoSink the verification code around the assert where it's handled and wrap in NDEBUG.
Eric Christopher [Fri, 23 Feb 2018 22:32:05 +0000 (22:32 +0000)]
Sink the verification code around the assert where it's handled and wrap in NDEBUG.

This has the advantage of making release only builds more warning
free and there's no need to make this routine a class function if
it isn't using class members anyhow.

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

6 years ago[InstSimplify] sqrt(X) * sqrt(X) --> X
Sanjay Patel [Fri, 23 Feb 2018 22:20:13 +0000 (22:20 +0000)]
[InstSimplify] sqrt(X) * sqrt(X) --> X

This was misplaced in InstCombine. We can loosen the FMF as a follow-up step.

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

6 years agoIntrinsics calls should avoid the PLT when "RtLibUseGOT" metadata is present.
Sriraman Tallam [Fri, 23 Feb 2018 21:32:06 +0000 (21:32 +0000)]
Intrinsics calls should avoid the PLT when "RtLibUseGOT" metadata is present.

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

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

6 years ago[InstCombine] allow fmul-sqrt folds with less than full -ffast-math
Sanjay Patel [Fri, 23 Feb 2018 21:16:12 +0000 (21:16 +0000)]
[InstCombine] allow fmul-sqrt folds with less than full -ffast-math

Also, add a Builder method for intrinsics to reduce code duplication for clients.

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

6 years agoSimplify a DEBUG statement to remove a set but not used variable in release builds.
Eric Christopher [Fri, 23 Feb 2018 21:14:47 +0000 (21:14 +0000)]
Simplify a DEBUG statement to remove a set but not used variable in release builds.

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

6 years ago[X86] Add assembler/disassembler support for blendm with zero masking and broacast.
Craig Topper [Fri, 23 Feb 2018 20:48:44 +0000 (20:48 +0000)]
[X86] Add assembler/disassembler support for blendm with zero masking and broacast.

Fixes PR31617

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

6 years ago[Power9] Add missing instructions to the Power 9 scheduler
Stefan Pintilie [Fri, 23 Feb 2018 20:37:10 +0000 (20:37 +0000)]
[Power9] Add missing instructions to the Power 9 scheduler

This is the first in a series of patches that will define more
instructions using InstRW so that we can move away from ItinRW
and ultimately have a complete Power 9 scheduler.

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

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

6 years ago[Hexagon] Recognize non-immediate constants in HexagonConstPropagation
Krzysztof Parzyszek [Fri, 23 Feb 2018 20:33:26 +0000 (20:33 +0000)]
[Hexagon] Recognize non-immediate constants in HexagonConstPropagation

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

6 years agoFixed unused variable warning. NFCI.
Simon Pilgrim [Fri, 23 Feb 2018 20:16:18 +0000 (20:16 +0000)]
Fixed unused variable warning. NFCI.

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

6 years ago[X86] Add DAG combine to remove (and X, 1) from in front of a v1i1 scalar to vector.
Craig Topper [Fri, 23 Feb 2018 20:13:42 +0000 (20:13 +0000)]
[X86] Add DAG combine to remove (and X, 1) from in front of a v1i1 scalar to vector.

These can be created by type legalization promoting the inputs to select to match scalar boolean contents.

We were trying to pattern match them away during isel, but its better to just remove them from the DAG.

I've cleaned up some patterns to not check for this 'and' anymore. But I suspect this has also opened up opportunities for pattern removal.

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

6 years ago[WebAssembly] Fix macro metaprogram to not duplicate code as much.
Benjamin Kramer [Fri, 23 Feb 2018 20:13:03 +0000 (20:13 +0000)]
[WebAssembly] Fix macro metaprogram to not duplicate code as much.

No functionality change intended.

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

6 years agoBecause of CVE-2018-6574, some compiler options and linker options are restricted...
Eric Christopher [Fri, 23 Feb 2018 20:12:24 +0000 (20:12 +0000)]
Because of CVE-2018-6574, some compiler options and linker options are restricted to prevent arbitrary code execution.

https://github.com/golang/go/issues/23672

By this change, building a Go code with LLVM Go bindings causes a compilation error as follows.

  go build llvm.org/llvm/bindings/go/llvm: invalid flag in #cgo LDFLAGS: -Wl,-headerpad_max_install_names

llvm-go tool generates cgo LDFLAGS directive from `llvm-config --ldflags` and it contains -Wl,option options. But -Wl,option is banned by default. To avoid this problem, we need to set $CGO_LDFLAGS_ALLOW environment variable to notify a compiler that the flags should be allowed.

  $ export CGO_LDFLAGS_ALLOW='-Wl,(-search_paths_first|-headerpad_max_install_names)'

By default for go 1.10 and go 1.9.5 these options should appear in the accepted set of options, however, if you're running into the error it's useful to have this documented.

Patch by Ryuichi Hayashida

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

6 years ago[X86][SSE] Generalize x > C-1 ? x+-C : 0 --> subus x, C combine for non-uniform constants
Simon Pilgrim [Fri, 23 Feb 2018 19:58:44 +0000 (19:58 +0000)]
[X86][SSE] Generalize x > C-1 ? x+-C : 0 --> subus x, C combine for non-uniform constants

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

6 years agoShrink various scheduling tables by using narrower types.
Benjamin Kramer [Fri, 23 Feb 2018 19:32:56 +0000 (19:32 +0000)]
Shrink various scheduling tables by using narrower types.

16 bits ought to be enough for everyone. This shrinks clang by ~1MB.

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

6 years ago[PATCH] [AArch64] Add new target feature to fuse conditional select
Evandro Menezes [Fri, 23 Feb 2018 19:27:43 +0000 (19:27 +0000)]
[PATCH] [AArch64] Add new target feature to fuse conditional select

This feature enables the fusion of the comparison and the conditional select
instructions together.

Differential revision: https://reviews.llvm.org/D42392

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

6 years agoFix compiler warning introduced in r325931. NFC.
Geoff Berry [Fri, 23 Feb 2018 19:11:33 +0000 (19:11 +0000)]
Fix compiler warning introduced in r325931. NFC.

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

6 years ago[Test] Fix the test to output to /dev/null instead of redirecting.
Matt Davis [Fri, 23 Feb 2018 19:03:04 +0000 (19:03 +0000)]
[Test] Fix the test to output to /dev/null instead of redirecting.

The redirection was confusing the windows build machine.

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

6 years ago[X86][SSE] Add x > C-1 ? x+-C : 0 --> subus x, C test caaes for non-uniform constants
Simon Pilgrim [Fri, 23 Feb 2018 18:57:26 +0000 (18:57 +0000)]
[X86][SSE] Add x > C-1 ? x+-C : 0 --> subus x, C test caaes for non-uniform constants

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

6 years ago[MemorySSA] Use fewer magic numbers. NFC
George Burgess IV [Fri, 23 Feb 2018 18:56:42 +0000 (18:56 +0000)]
[MemorySSA] Use fewer magic numbers. NFC

INVALID_MEMORYACCESS_ID == 0.

This patch also makes this initialization consistent with the rest of
the "invalid" ones in this file.

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

6 years ago[MemorySSA] Reduce padding in MemoryDefs. NFC
George Burgess IV [Fri, 23 Feb 2018 18:50:39 +0000 (18:50 +0000)]
[MemorySSA] Reduce padding in MemoryDefs. NFC

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

6 years ago[X86] Custom split v32i16/v64i8 bitcasts when AVX512F is available, but BWI is not.
Craig Topper [Fri, 23 Feb 2018 18:43:36 +0000 (18:43 +0000)]
[X86] Custom split v32i16/v64i8 bitcasts when AVX512F is available, but BWI is not.

The test changes you can see are related to the changes in ReplaceNodeResults. Though shuffle-vs-trunc-512.ll does have a test that exercises the code in LowerBITCAST. Looks like the test output didn't change because DAG combining is able to clean up the resulting type legalization. Adding the custom hook just makes type legalization work less hard.

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

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

6 years ago[MachineOperand][Target] MachineOperand::isRenamable semantics changes
Geoff Berry [Fri, 23 Feb 2018 18:25:08 +0000 (18:25 +0000)]
[MachineOperand][Target] MachineOperand::isRenamable semantics changes

Summary:
Add a target option AllowRegisterRenaming that is used to opt in to
post-register-allocation renaming of registers.  This is set to 0 by
default, which causes the hasExtraSrcRegAllocReq/hasExtraDstRegAllocReq
fields of all opcodes to be set to 1, causing
MachineOperand::isRenamable to always return false.

Set the AllowRegisterRenaming flag to 1 for all in-tree targets that
have lit tests that were effected by enabling COPY forwarding in
MachineCopyPropagation (AArch64, AMDGPU, ARM, Hexagon, Mips, PowerPC,
RISCV, Sparc, SystemZ and X86).

Add some more comments describing the semantics of the
MachineOperand::isRenamable function and how it is set and maintained.

Change isRenamable to check the operand's opcode
hasExtraSrcRegAllocReq/hasExtraDstRegAllocReq bit directly instead of
relying on it being consistently reflected in the IsRenamable bit
setting.

Clear the IsRenamable bit when changing an operand's register value.

Remove target code that was clearing the IsRenamable bit when changing
registers/opcodes now that this is done conservatively by default.

Change setting of hasExtraSrcRegAllocReq in AMDGPU target to be done in
one place covering all opcodes that have constant pipe read limit
restrictions.

Reviewers: qcolombet, MatzeB

Subscribers: aemerson, arsenm, jyknight, mcrosier, sdardis, nhaehnle, javed.absar, tpr, arichardson, kristof.beyls, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, jordy.potman.lists, apazos, sabuasal, niosHD, escha, nemanjai, llvm-commits

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

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

6 years ago[Debug] Add dbg.value intrinsics for PHIs created during LCSSA.
Matt Davis [Fri, 23 Feb 2018 17:38:27 +0000 (17:38 +0000)]
[Debug] Add dbg.value intrinsics for PHIs created during LCSSA.

Summary:
This patch is an enhancement to propagate dbg.value information when Phis are created on behalf of LCSSA.
I noticed a case where a value carried across a loop was reported as <optimized out>.

Specifically this case:
```
int bar(int x, int y) {
  return x + y;
}

int foo(int size) {
  int val = 0;
  for (int i = 0; i < size; ++i) {
    val = bar(val, i);  // Both val and i are correct
  }
  return val; // <optimized out>
}
```

In the above case, after all of the interesting computation completes our value
is reported as "optimized out." This change will add a dbg.value to correct this.

This patch also moves the dbg.value insertion routine from LoopRotation.cpp
into Local.cpp, so that we can share it in both places (LoopRotation and LCSSA).

Reviewers: mzolotukhin, aprantl, vsk, davide

Reviewed By: aprantl, vsk

Subscribers: dberlin, llvm-commits

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

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

6 years ago[BPI] Detect branches in loops that make themselves not taken
John Brawn [Fri, 23 Feb 2018 17:17:31 +0000 (17:17 +0000)]
[BPI] Detect branches in loops that make themselves not taken

If we have a loop like this:
 int n = 0;
 while (...) {
  if (++n >= MAX) {
    n = 0;
  }
 }
then the body of the 'if' statement will only be executed once every MAX
iterations. Detect this by looking for branches in loops where taking the branch
makes the branch condition evaluate to 'not taken' in the next iteration of the
loop, and reduce the probability of such branches.

This slightly improves EEMBC benchmarks on cortex-m4/cortex-m33 due to making
better choices in if-conversion, but has no effect on any other cpu/benchmark
that I could detect.

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

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

6 years ago[InstCombine] refactor fmul with negated op folds; NFCI
Sanjay Patel [Fri, 23 Feb 2018 17:14:28 +0000 (17:14 +0000)]
[InstCombine] refactor fmul with negated op folds; NFCI

The existing code was inefficiently looking for 'nsz' variants.
That's unnecessary because we canonicalize those to the expected
form with -0.0.

We may also want to adjust or remove the fold that sinks negation.
We don't do that for fdiv (or integer ops?). That should be uniform?
It may also lead to missed optimization as in PR21914:
https://bugs.llvm.org/show_bug.cgi?id=21914
...or we just have to fix other passes to avoid that problem.

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

6 years ago[InstCombine] use FMF-copying functions to reduce code; NFCI
Sanjay Patel [Fri, 23 Feb 2018 17:07:29 +0000 (17:07 +0000)]
[InstCombine] use FMF-copying functions to reduce code; NFCI

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

6 years ago[X86] Regenerate i128 multiply tests
Simon Pilgrim [Fri, 23 Feb 2018 15:55:27 +0000 (15:55 +0000)]
[X86] Regenerate i128 multiply tests

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

6 years ago[PowerPC] Code cleanup. Remove instructions that were withdrawn from Power 9.
Stefan Pintilie [Fri, 23 Feb 2018 15:55:16 +0000 (15:55 +0000)]
[PowerPC] Code cleanup. Remove instructions that were withdrawn from Power 9.

The following set of instructions was originally planned to be added for Power 9
and so code was added to support them. However, a decision was made later on to
withdraw support for these instructions in the hardware.
xscmpnedp
xvcmpnesp
xvcmpnedp
This patch removes support for the instructions that were not added.

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

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

6 years ago[mips] finish removal of unused fields in MipsInstructionSelector
Petar Jovanovic [Fri, 23 Feb 2018 15:47:05 +0000 (15:47 +0000)]
[mips] finish removal of unused fields in MipsInstructionSelector

r325916 missed to remove calls in constructor.

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

6 years ago[mips] remove unused fields in MipsInstructionSelector
Petar Jovanovic [Fri, 23 Feb 2018 15:34:02 +0000 (15:34 +0000)]
[mips] remove unused fields in MipsInstructionSelector

Unused fields cause buildbreak if -Werror,-Wunused-private-field is passed.

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

6 years agoSupport for the mno-stack-arg-probe flag
Hans Wennborg [Fri, 23 Feb 2018 13:46:25 +0000 (13:46 +0000)]
Support for the mno-stack-arg-probe flag

Adds support for this flag. There is also another piece for clang
(separate review). More info:
https://bugs.llvm.org/show_bug.cgi?id=36221

By Ruslan Nikolaev!

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

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

6 years ago[SystemZ] Also update the CHECK line for VPDI
Jonas Paulsson [Fri, 23 Feb 2018 13:22:46 +0000 (13:22 +0000)]
[SystemZ]  Also update the CHECK line for VPDI

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

6 years ago[SystemZ] Fix VPDI argument in test.
Jonas Paulsson [Fri, 23 Feb 2018 13:20:57 +0000 (13:20 +0000)]
[SystemZ] Fix VPDI argument in test.

To select element 1 from each half with VPDI, a constant of 5 should be used.

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

6 years ago[X86][F16C] Regenerate half conversion tests
Simon Pilgrim [Fri, 23 Feb 2018 13:18:13 +0000 (13:18 +0000)]
[X86][F16C] Regenerate half conversion tests

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

6 years agollvm-config: Add advapi32 to --system-libs on Windows (PR36372)
Hans Wennborg [Fri, 23 Feb 2018 12:20:26 +0000 (12:20 +0000)]
llvm-config: Add advapi32 to --system-libs on Windows (PR36372)

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

6 years ago[WebAssembly] NDEBUG is spelled without a leading underscore.
Benjamin Kramer [Fri, 23 Feb 2018 12:20:18 +0000 (12:20 +0000)]
[WebAssembly] NDEBUG is spelled without a leading underscore.

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

6 years ago[DAGCOmbine] Ensure that (brcond (setcc ...)) is handled in a canonical manner.
Amaury Sechet [Fri, 23 Feb 2018 11:50:42 +0000 (11:50 +0000)]
[DAGCOmbine] Ensure that (brcond (setcc ...)) is handled in a canonical manner.

Summary:
There are transformation that change setcc into other constructs, and transform that try to reconstruct a setcc from the brcond condition. Depending on what order these transform are done, the end result differs.

Most of the time, it is preferable to get a setcc as a brcond argument (and this is why brcond try to recreate the setcc in the first place) so we ensure this is done every time by also doing it at the setcc level when the only user is a brcond.

Reviewers: spatel, hfinkel, niravd, craig.topper

Subscribers: nhaehnle, llvm-commits

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

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

6 years agoRevert "TableGen: Fix typeIsConvertibleTo for record types"
Nicolai Haehnle [Fri, 23 Feb 2018 11:31:49 +0000 (11:31 +0000)]
Revert "TableGen: Fix typeIsConvertibleTo for record types"

This reverts r325884.

Clang's TableGen has dependencies on the exact ordering of superclasses.
Revert this change fully for now to fix the build.

Change-Id: Ib297f5571cc7809f00838702ad7ab53d47335b26

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

6 years ago[MIPS GlobalISel] Adding GlobalISel
Petar Jovanovic [Fri, 23 Feb 2018 11:06:40 +0000 (11:06 +0000)]
[MIPS GlobalISel] Adding GlobalISel

Add GlobalISel infrastructure up to the point where we can select a ret
void.

Patch by Petar Avramovic.

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

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

6 years agoTableGen: Avoid using resolveListElementReference in TGParser
Nicolai Haehnle [Fri, 23 Feb 2018 10:46:21 +0000 (10:46 +0000)]
TableGen: Avoid using resolveListElementReference in TGParser

A subsequent change intends to remove resolveListElementReference
entirely. This part of the removal can be split out for better
bisectability.

Change-Id: Ibd762d88fd2d1e2cc116a259e2a27a5e9f9a8b10

Reviewers: arsenm, craig.topper, tra, MartinO

Subscribers: wdng, llvm-commits

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

Change-Id: Ifb695041cef1964ad8a3102f448249501a9243f0

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

6 years agoTableGen: BitInit and VarBitInit are typed
Nicolai Haehnle [Fri, 23 Feb 2018 10:46:18 +0000 (10:46 +0000)]
TableGen: BitInit and VarBitInit are typed

Summary: Change-Id: I54e337a0b525e9649534bc5f90e5e07c0772e334

Reviewers: arsenm, craig.topper, tra, MartinO

Subscribers: wdng, llvm-commits

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

Change-Id: I07f78e793192974c2b90690ce644589fe4891e41

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

6 years agoTableGen: Fix typeIsConvertibleTo for record types
Nicolai Haehnle [Fri, 23 Feb 2018 10:46:13 +0000 (10:46 +0000)]
TableGen: Fix typeIsConvertibleTo for record types

Summary:
Only check whether the left-hand side type is a subclass (or equal to)
the right-hand side type.

This requires a further fix in handling !if expressions and in type
resolution.

Furthermore, reverse the order of superclasses so that resolveTypes will
find a least common ancestor at least in simple cases.

Add a test that used to be accepted without flagging the obvious type
error.

Change-Id: Ib366db1a4e6a079f1a0851e469b402cddae76714

Reviewers: arsenm, craig.topper, tra, MartinO

Subscribers: wdng, llvm-commits

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

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

6 years agoTableGen: Add !size operation
Nicolai Haehnle [Fri, 23 Feb 2018 10:46:07 +0000 (10:46 +0000)]
TableGen: Add !size operation

Summary:
Returns the size of a list. I have found this to be rather useful in some
development for the AMDGPU backend where we could simplify our .td files
by concatenating list<LLVMType> for complex intrinsics. Doing so requires
us to compute the position argument for LLVMMatchType.

Basically, the usage is in a pattern that looks somewhat like this:

    list<LLVMType> argtypes =
        !listconcat(base,
                    [llvm_any_ty, LLVMMatchType<!size(base)>]);

Change-Id: I360a0b000fd488d18bea412228230fd93722bd2c

Reviewers: arsenm, craig.topper, tra, MartinO

Subscribers: wdng, llvm-commits, tpr

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

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

6 years agoAMDGPU: Track physreg uses in SILoadStoreOptimizer
Nicolai Haehnle [Fri, 23 Feb 2018 10:45:56 +0000 (10:45 +0000)]
AMDGPU: Track physreg uses in SILoadStoreOptimizer

Summary:
This handles def-after-use of physregs, and allows us to merge loads and
stores even across some physreg defs (typically M0 defs).

Change-Id: I076484b2bda27c2cf46013c845a0380c5b89b67b

Reviewers: arsenm, mareko, rampitec

Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits

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

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

6 years agoStructurizeCFG: Test for branch divergence correctly
Nicolai Haehnle [Fri, 23 Feb 2018 10:45:46 +0000 (10:45 +0000)]
StructurizeCFG: Test for branch divergence correctly

Summary:
This fixes cases like the new test @nonuniform. In that test, %cc itself
is a uniform value; however, when reading it after the end of the loop in
basic block %if, its value is effectively non-uniform.

This problem was encountered in
https://bugs.freedesktop.org/show_bug.cgi?id=103743; however, this change
in itself is not sufficient to fix that bug, as there is another issue
in the AMDGPU backend.

Change-Id: I32bbffece4a32f686fab54964dae1a5dd72949d4

Reviewers: arsenm, rampitec, jlebar

Subscribers: wdng, tpr, llvm-commits

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

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

6 years agoMark MergedLoadStoreMotion as not preserving MemDep results
Bjorn Steinbrink [Fri, 23 Feb 2018 10:41:57 +0000 (10:41 +0000)]
Mark MergedLoadStoreMotion as not preserving MemDep results

Summary:
MemDep caches results that signify that a dependence is non-local, and
there is currently no way to invalidate such cache entries.
Unfortunately, when MLSM sinks a store that can result in a non-local
dependence becoming a local one, and then MemDep gives wrong answers.
The easiest way out here is to just say that MLSM does indeed not
preserve MemDep results.

Reviewers: davide, Gerolf

Subscribers: llvm-commits

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

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

6 years ago[Mips] Return true in enableMultipleCopyHints().
Jonas Paulsson [Fri, 23 Feb 2018 08:30:15 +0000 (08:30 +0000)]
[Mips]  Return true in enableMultipleCopyHints().

Enable multiple COPY hints to eliminate more COPYs during register allocation.

Note that this is something all targets should do, see
https://reviews.llvm.org/D38128.

Review: Simon Dardis

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

6 years ago[WebAssembly] Add first claass symbol table to wasm objects
Sam Clegg [Fri, 23 Feb 2018 05:08:34 +0000 (05:08 +0000)]
[WebAssembly] Add first claass symbol table to wasm objects

This is combination of two patches by Nicholas Wilson:
  1. https://reviews.llvm.org/D41954
  2. https://reviews.llvm.org/D42495

Along with a few local modifications:
- One change I made was to add the UNDEFINED bit to the binary format
  to avoid the extra byte used when writing data symbols.  Although this
  bit is redundant for other symbols types (i.e. undefined can be
  implied if a function or global is a wasm import)
- I prefer to be explicit and consistent and not have derived flags.
- Some field renaming.
- Some reverting of unrelated minor changes.
- No test output differences.

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

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

6 years agoRemove file missed by r325852 due to merge conflict.
Richard Smith [Fri, 23 Feb 2018 01:57:28 +0000 (01:57 +0000)]
Remove file missed by r325852 due to merge conflict.

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

6 years agoRevert r325128 ("[X86] Reduce Store Forward Block issues in HW").
Richard Smith [Fri, 23 Feb 2018 01:43:46 +0000 (01:43 +0000)]
Revert r325128 ("[X86] Reduce Store Forward Block issues in HW").

This is causing miscompiles in some situations. See the llvm-commits thread for the commit for details.

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

6 years ago[GISel]: Fix base case for m_any_of PatternMatcher.
Aditya Nandakumar [Fri, 23 Feb 2018 01:01:59 +0000 (01:01 +0000)]
[GISel]: Fix base case for m_any_of PatternMatcher.

The base case for any_of was incorrectly returning true. Also add test
case which uses m_any_of(preds...) where none of the predicates are
true.

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

6 years ago[X86] Turn setne X, signedmax into setgt signedmax, X in LowerVSETCC to avoid an...
Craig Topper [Fri, 23 Feb 2018 00:21:39 +0000 (00:21 +0000)]
[X86] Turn setne X, signedmax into setgt signedmax, X in LowerVSETCC to avoid an invert

We won't be able to fold the constant pool load, but its still better than materialing ones and xoring for the invert if we used PCMPEQ.

This will fix another regression from D42948.

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

6 years ago[AArch64] Refactor macro fusion (NFC)
Evandro Menezes [Fri, 23 Feb 2018 00:14:39 +0000 (00:14 +0000)]
[AArch64] Refactor macro fusion (NFC)

Move checks for each fusion case into separate functions for better
legibility and maintainability.

Differential revision: https://reviews.llvm.org/D43649

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

6 years ago[PDB] Check the result of setLoadAddress()
Aaron Smith [Fri, 23 Feb 2018 00:02:27 +0000 (00:02 +0000)]
[PDB] Check the result of setLoadAddress()

Summary: Change setLoadAddress() to return true or false on failure.

Reviewers: zturner, llvm-commits

Reviewed By: zturner

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

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

6 years agoFix grammar. NFC.
Rafael Espindola [Thu, 22 Feb 2018 23:59:46 +0000 (23:59 +0000)]
Fix grammar. NFC.

Thank to Eric Christopher for noticing.

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

6 years ago[X86] Turn setne X, signedmin into setgt X, signedmin in LowerVSETCC to avoid an...
Craig Topper [Thu, 22 Feb 2018 23:46:28 +0000 (23:46 +0000)]
[X86] Turn setne X, signedmin into setgt X, signedmin in LowerVSETCC to avoid an invert

This will fix one of the regressions from D42948.

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

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

6 years ago[AArch64] Improve macro fusion test case
Evandro Menezes [Thu, 22 Feb 2018 23:32:06 +0000 (23:32 +0000)]
[AArch64] Improve macro fusion test case

Improve a vector in the test case for the fusion of address generation and
loads or stores.  Otherwise, NFC.

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

6 years agoFix llvm-pdbutil to handle new built-in types
Adrian McCarthy [Thu, 22 Feb 2018 23:16:56 +0000 (23:16 +0000)]
Fix llvm-pdbutil to handle new built-in types

Summary:
The built-in PDB types enum has been extended to include char16_t and char32_t.
llvm-pdbutil was hitting an llvm_unreachable because it didn't know about these
new values.  The new values are not yet in the DIA documentation, but are
listed in the cvconst.h header that comes as part of the DIA SDK.

Reviewers: asmith, zturner, rnk

Subscribers: stella.stamenova, llvm-commits, sanjoy

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

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

6 years agoUpdate comment for whether or not we can optimize an alias - we're
Eric Christopher [Thu, 22 Feb 2018 23:12:11 +0000 (23:12 +0000)]
Update comment for whether or not we can optimize an alias - we're
checking the alias and not the aliasee. If the alias can be interposed
then we shouldn't do anything.

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

6 years agoFix the build of the wasm backend.
Benjamin Kramer [Thu, 22 Feb 2018 22:29:27 +0000 (22:29 +0000)]
Fix the build of the wasm backend.

toString conflicts with llvm::toString here. Yay for overly generic
function names.

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

6 years ago[InstrTypes] add frem and fneg with FMF creators
Sanjay Patel [Thu, 22 Feb 2018 21:46:13 +0000 (21:46 +0000)]
[InstrTypes] add frem and fneg with FMF creators

The more popular opcodes were added at r325730, but we
should have everything here for symmetry. I think both
of these can be used in InstCombine already, but I'll
make those changes as separate clean-ups for InstCombine.

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

6 years ago[DWARFv5] Turn an assert into a diagnostic. Hand-coded assembler files
Paul Robinson [Thu, 22 Feb 2018 21:03:33 +0000 (21:03 +0000)]
[DWARFv5] Turn an assert into a diagnostic. Hand-coded assembler files
should not trigger assertions.

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

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

6 years ago[ThinLTO/gold] Perform cache pruning when cache directory specified
Teresa Johnson [Thu, 22 Feb 2018 20:57:05 +0000 (20:57 +0000)]
[ThinLTO/gold] Perform cache pruning when cache directory specified

Summary:
As pointed out in the review for D37993, for consistency with other
linkers, gold plugin should perform cache pruning whenever there is a
cache directory specified, which will use the default cache policy.

Reviewers: pcc

Subscribers: llvm-commits, inglorion

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

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

6 years ago[TargetLowering] Rename isCondCodeLegal to isCondCodeLegalOrCustom. Add real isCondCo...
Craig Topper [Thu, 22 Feb 2018 20:51:26 +0000 (20:51 +0000)]
[TargetLowering] Rename isCondCodeLegal to isCondCodeLegalOrCustom. Add real isCondCodeLegal. Update callers to use one or the other.

isCondCodeLegal internally checked Legal or Custom which is misleading. Though no targets set any cond code action to Custom today.

So I've renamed isCondCodeLegal to isCondCodeLegalOrCustom and added a real isCondCodeLegal that only checks Legal.

I've changed legalization code to use isCondCodeLegalOrCustom and left things reachable via DAG combine as isCondCodeLegal. I've also changed some places that called getCondCodeAction and compared to Legal to just use isCondCodeLegal.

I'm looking at trying to keep SETCC all the way to isel for the AVX512 integer comparisons and I suspect I'll need to make some condition codes Custom to stop DAG combine from changing things post LegalizeOps. Prior to this only Expand stopped DAG combine, but that causes LegalizeOps to try to swap operands or invert rather than calling our Custom handler.

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

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

6 years ago[PDB] Add missing override to silence buildbots
Aaron Smith [Thu, 22 Feb 2018 20:28:40 +0000 (20:28 +0000)]
[PDB] Add missing override to silence buildbots

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

6 years ago[X86] Make the subus special case in LowerVSETCC self contained
Craig Topper [Thu, 22 Feb 2018 20:24:18 +0000 (20:24 +0000)]
[X86] Make the subus special case in LowerVSETCC self contained

Previously this code overrode the flags and opcode used by the later code in LowerVSETCC. This makes the code difficult to read and follow.

This patch moves all the SUBUS code into its own function and makes it responsible for creating its own SDNodes on success.

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

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

6 years ago[PDB] Fix buildbot failure from missing include for DIAEnumLineNumbers
Aaron Smith [Thu, 22 Feb 2018 20:00:07 +0000 (20:00 +0000)]
[PDB] Fix buildbot failure from missing include for DIAEnumLineNumbers

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

6 years agoRevert "[DebugInfo][FastISel] Fix dropping dbg.value()"
Sander de Smalen [Thu, 22 Feb 2018 19:53:59 +0000 (19:53 +0000)]
Revert "[DebugInfo][FastISel] Fix dropping dbg.value()"

This patch reverts r325440 and r325438 because it triggers an
assertion in SelectionDAGBuilder.cpp. Also having debug enabled
may unintentionally affect code-gen. The patch is reverted until
we find a better solution.

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

6 years ago[PDB] Implement more find methods for PDB symbols
Aaron Smith [Thu, 22 Feb 2018 19:47:43 +0000 (19:47 +0000)]
[PDB] Implement more find methods for PDB symbols

Summary:
Add additional find methods on PDB raw symbols.

findChildrenByAddr()
findChildrenByVA()
findInlineFramesByAddr()
findInlineFramesByVA()
findInlineLines()
findInlineLinesByAddr()
findInlineLinesByRVA()
findInlineLinesByVA()

Reviewers: zturner, llvm-commits

Reviewed By: zturner

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

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

6 years ago[ThinLTO] Represent relative BF using a scaled representation .
Easwaran Raman [Thu, 22 Feb 2018 19:44:08 +0000 (19:44 +0000)]
[ThinLTO] Represent relative BF using a scaled representation .

Summary:
The current integer representation of relative block frequency prevents
representing relative block frequencies below 1. This change uses a 8 of
the 29 bits to represent the decimal part by using a fixed scale of -8.

Reviewers: tejohnson, davidxl

Subscribers: mehdi_amini, inglorion, llvm-commits

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

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

6 years agoFix DataFlowSanitizer instrumentation pass to take parameter position changes into...
Peter Collingbourne [Thu, 22 Feb 2018 19:09:07 +0000 (19:09 +0000)]
Fix DataFlowSanitizer instrumentation pass to take parameter position changes into account for custom functions.

When DataFlowSanitizer transforms a call to a custom function, the
new call has extra parameters. The attributes on parameters must be
updated to take the new position of each parameter into account.

Patch by Sam Kerner!

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

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

6 years ago[ThinLTO] Always create linked objects file for --thinlto-index-only=
Vitaly Buka [Thu, 22 Feb 2018 19:06:15 +0000 (19:06 +0000)]
[ThinLTO] Always create linked objects file for --thinlto-index-only=

Summary:
ThinLTO indexing may decide to skip all objects. If we don't write something to
the list build system may consider this as failure or linker can reuse a file
from the previews build.

Reviewers: pcc, tejohnson

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

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

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

6 years ago[gold] Extract runLTO to avoid exit(0) from function with non-trivial objects on...
Vitaly Buka [Thu, 22 Feb 2018 19:06:05 +0000 (19:06 +0000)]
[gold] Extract runLTO to avoid exit(0) from function with non-trivial objects on the stack

Reviewers: tejohnson, pcc

Subscribers: inglorion, llvm-commits

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

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

6 years ago[libFuzzer] Include TEMP_MAX_LEN in Fuzzer::PrintStats.
Matt Morehouse [Thu, 22 Feb 2018 19:00:17 +0000 (19:00 +0000)]
[libFuzzer] Include TEMP_MAX_LEN in Fuzzer::PrintStats.

Reviewers: kcc

Reviewed By: kcc

Subscribers: llvm-commits

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

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

6 years ago[AlignmentFromAssumptions] Set source and dest alignments of memory intrinsiscs separ...
Daniel Neilson [Thu, 22 Feb 2018 18:55:59 +0000 (18:55 +0000)]
[AlignmentFromAssumptions] Set source and dest alignments of memory intrinsiscs separately

Summary:
This change is part of step five in the series of changes to remove alignment argument from
memcpy/memmove/memset in favour of alignment attributes. In particular, this changes the
AlignmentFromAssumptions pass to cease using the old getAlignment()/setAlignment API of
MemoryIntrinsic in favour of getting/setting source & dest specific alignments through
the new API. This allows us to simplify some of the code in this pass and also be more
aggressive about setting the source and destination alignments separately.

Steps:
Step 1) Remove alignment parameter and create alignment parameter attributes for
memcpy/memmove/memset. ( rL322965, rC322964, rL322963 )
Step 2) Expand the IRBuilder API to allow creation of memcpy/memmove with differing
source and dest alignments. ( rL323597 )
Step 3) Update Clang to use the new IRBuilder API. ( rC323617 )
Step 4) Update Polly to use the new IRBuilder API. ( rL323618 )
Step 5) Update LLVM passes that create memcpy/memmove calls to use the new IRBuilder API,
and those that use use MemIntrinsicInst::[get|set]Alignment() to use [get|set]DestAlignment()
and [get|set]SourceAlignment() instead. ( rL323886, rL323891, rL324148, rL324273, rL324278,
rL324384, rL324395, rL324402, rL324626, rL324642, rL324653, rL324654, rL324773, rL324774,
rL324781, rL324784, rL324955, rL324960 )
Step 6) Remove the single-alignment IRBuilder API for memcpy/memmove, and the
MemIntrinsicInst::[get|set]Alignment() methods.

Reference
   http://lists.llvm.org/pipermail/llvm-dev/2015-August/089384.html
   http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html

Reviewers: hfinkel, bollu, reames

Reviewed By: reames

Subscribers: reames, llvm-commits

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

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

6 years ago[SelectionDAG] Move matchUnaryPredicate/matchBinaryPredicate into SelectionDAGNodes.h
Simon Pilgrim [Thu, 22 Feb 2018 18:45:13 +0000 (18:45 +0000)]
[SelectionDAG] Move matchUnaryPredicate/matchBinaryPredicate into SelectionDAGNodes.h

This allows us to improve vector constant matching in more DAG code (backends, TargetLowering etc.).

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

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

6 years ago[MC] Don't crash on modulo by zero (PR35650)
Simon Pilgrim [Thu, 22 Feb 2018 18:06:48 +0000 (18:06 +0000)]
[MC] Don't crash on modulo by zero (PR35650)

Extension to D12776, handle modulo by zero in the same way we handle divide by zero.

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

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

6 years ago[IRBuilder] add creators for FP with FMF; NFCI
Sanjay Patel [Thu, 22 Feb 2018 17:33:20 +0000 (17:33 +0000)]
[IRBuilder] add creators for FP with FMF; NFCI

Also, add a helper for the constant folder to reduce duplication.

It seems out-of-place for and/or to be doing simplifications here?
Otherwise, I could have used the helper on those opcodes too.

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

6 years ago[X86][AVX512] Add DQ+VLX scalar int<->fp tests cases for D43441
Simon Pilgrim [Thu, 22 Feb 2018 16:29:08 +0000 (16:29 +0000)]
[X86][AVX512] Add DQ+VLX scalar int<->fp tests cases for D43441

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

6 years ago[DEBUGINFO] Do not output labels for empty macinfo sections.
Alexey Bataev [Thu, 22 Feb 2018 16:20:30 +0000 (16:20 +0000)]
[DEBUGINFO] Do not output labels for empty macinfo sections.

Summary:
If there is no debug info for macros, do not emit labels for empty
macinfo sections.

Reviewers: probinson, echristo

Subscribers: aprantl, llvm-commits, JDevlieghere

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

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

6 years agoTableGen: Add strict assertions to sanity check earlier type checking
Nicolai Haehnle [Thu, 22 Feb 2018 15:27:12 +0000 (15:27 +0000)]
TableGen: Add strict assertions to sanity check earlier type checking

Summary:
Both of these errors should have been caught by type-checking during
parsing.

Change-Id: I891087936fd1a91d21bcda57c256e3edbe12b94d

Reviewers: arsenm, craig.topper, tra, MartinO

Subscribers: wdng, llvm-commits

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

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