OSDN Git Service

android-x86/external-llvm.git
5 years agoAMDGPU/GlobalISel: Implement select for G_INSERT
Tom Stellard [Fri, 1 Mar 2019 00:50:26 +0000 (00:50 +0000)]
AMDGPU/GlobalISel: Implement select for G_INSERT

Re-commit r344310.

Reviewers: arsenm

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, rovka, kristof.beyls, dstuttard, tpr, t-tye, llvm-commits

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

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

5 years ago[WebAssembly] Fix crash when @llvm.global_dtors is external
Thomas Lively [Fri, 1 Mar 2019 00:12:13 +0000 (00:12 +0000)]
[WebAssembly] Fix crash when @llvm.global_dtors is external

Reviewers: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm

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

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

5 years agoAMDGPU/GlobalISel: Implement select for G_EXTRACT
Tom Stellard [Thu, 28 Feb 2019 23:37:48 +0000 (23:37 +0000)]
AMDGPU/GlobalISel: Implement select for G_EXTRACT

Reviewers: arsenm

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, rovka, kristof.beyls, dstuttard, tpr, t-tye, llvm-commits

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

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

5 years ago[PPC] Secure PLT only has meaning for PIC
Joerg Sonnenberger [Thu, 28 Feb 2019 23:33:09 +0000 (23:33 +0000)]
[PPC] Secure PLT only has meaning for PIC

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

5 years ago[sancov] Instrument reachable blocks that end in unreachable
Reid Kleckner [Thu, 28 Feb 2019 22:54:30 +0000 (22:54 +0000)]
[sancov] Instrument reachable blocks that end in unreachable

Summary:
These sorts of blocks often contain calls to noreturn functions, like
longjmp, throw, or trap. If they don't end the program, they are
"interesting" from the perspective of sanitizer coverage, so we should
instrument them. This was discussed in https://reviews.llvm.org/D57982.

Reviewers: kcc, vitalybuka

Subscribers: llvm-commits, craig.topper, efriedma, morehouse, hiraditya

Tags: #llvm

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

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

5 years agollvm-readobj: Try the DWARF CFI dumper on all machines.
Peter Collingbourne [Thu, 28 Feb 2019 22:42:55 +0000 (22:42 +0000)]
llvm-readobj: Try the DWARF CFI dumper on all machines.

There's no reason to limit the DWARF CFI dumper to EM_386 and EM_X86_64;
ELF files could contain DWARF CFI on almost any platform (even 32-bit ARM;
NetBSD uses DWARF CFI on that platform). So start using the DWARF CFI dumper
unconditionally so that we can dump .eh_frame sections on the remaining ELF
platforms as well as in NetBSD binaries.

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

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

5 years agoUpdate testcase since llvm-dwarfdump got more accurate in r355148.
Adrian Prantl [Thu, 28 Feb 2019 22:26:00 +0000 (22:26 +0000)]
Update testcase since llvm-dwarfdump got more accurate in r355148.

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

5 years agodsymutil support for DW_OP_convert
Adrian Prantl [Thu, 28 Feb 2019 22:12:32 +0000 (22:12 +0000)]
dsymutil support for DW_OP_convert

Add support for cloning DWARF expressions that contain base type DIE
references in dsymutil.

<rdar://problem/48167812>

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

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

5 years agogn build: Merge r355133.
Peter Collingbourne [Thu, 28 Feb 2019 22:12:09 +0000 (22:12 +0000)]
gn build: Merge r355133.

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

5 years agogn build: Merge r355035
Nico Weber [Thu, 28 Feb 2019 22:08:18 +0000 (22:08 +0000)]
gn build: Merge r355035

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

5 years agogn build: Merge r355024
Nico Weber [Thu, 28 Feb 2019 22:07:37 +0000 (22:07 +0000)]
gn build: Merge r355024

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

5 years agoTrying to fix bot breakage due to symbols not defined for WINDOWS!
Manman Ren [Thu, 28 Feb 2019 20:48:19 +0000 (20:48 +0000)]
Trying to fix bot breakage due to symbols not defined for WINDOWS!

Follow up to r355133

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

5 years ago[AArch64] [Windows] Don't skip constructing UnwindHelp.
Eli Friedman [Thu, 28 Feb 2019 20:38:45 +0000 (20:38 +0000)]
[AArch64] [Windows] Don't skip constructing UnwindHelp.

In certain cases, the first non-frame-setup instruction in a function is
a branch.  For example, it could be a cbz on an argument.  Make sure we
correctly allocate the UnwindHelp, and find an appropriate register to
use to initialize it.

Fixes https://bugs.llvm.org/show_bug.cgi?id=40184

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

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

5 years ago[AArch64] [Windows] Fix llvm-readobj -unwind output with many epilogs.
Eli Friedman [Thu, 28 Feb 2019 20:33:22 +0000 (20:33 +0000)]
[AArch64] [Windows] Fix llvm-readobj -unwind output with many epilogs.

The number of epilog scopes may not fit into a uint8_t.

Fixes https://bugs.llvm.org/show_bug.cgi?id=40855

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

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

5 years ago[AArch64] Improve FP16 vector convert from short instructions.
Abderrazek Zaafrani [Thu, 28 Feb 2019 20:21:46 +0000 (20:21 +0000)]
[AArch64] Improve FP16 vector convert from short instructions.
https://reviews.llvm.org/D58563

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

5 years agoAdd a module pass for order file instrumentation
Manman Ren [Thu, 28 Feb 2019 20:13:38 +0000 (20:13 +0000)]
Add a module pass for order file instrumentation

The basic idea of the pass is to use a circular buffer to log the execution ordering of the functions. We only log the function when it is first executed. We use a 8-byte hash to log the function symbol name.

In this pass, we add three global variables:
(1) an order file buffer: a circular buffer at its own llvm section.
(2) a bitmap for each module: one byte for each function to say if the function is already executed.
(3) a global index to the order file buffer.

At the function prologue, if the function has not been executed (by checking the bitmap), log the function hash, then atomically increase the index.

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

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

5 years ago[PGO] Context sensitive PGO (part 2)
Rong Xu [Thu, 28 Feb 2019 19:55:07 +0000 (19:55 +0000)]
[PGO] Context sensitive PGO (part 2)

Part 2 of CSPGO changes (mostly related to ProfileSummary).
Note that I use a default parameter in setProfileSummary() and getSummary().
This is to break the dependency in clang. I will make the parameter explicit
after changing clang in a separated patch.

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

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

5 years ago[x86] scalarize extract element 0 of FP math
Sanjay Patel [Thu, 28 Feb 2019 19:47:04 +0000 (19:47 +0000)]
[x86] scalarize extract element 0 of FP math

This is another step towards ensuring that we produce the optimal code for reductions,
but there are other potential benefits as seen in the tests diffs:

  1. Memory loads may get scalarized resulting in more efficient code.
  2. Memory stores may get scalarized resulting in more efficient code.
  3. Complex ops like fdiv/sqrt get scalarized which may be faster instructions depending on uarch.
  4. Even simple ops like addss/subss/mulss/roundss may result in faster operation/less frequency throttling when scalarized depending on uarch.

The TODO comment suggests 1 or more follow-ups for opcodes that can currently result in regressions.

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

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

5 years agobpf: disassembler support for XADD under sub-register mode
Jiong Wang [Thu, 28 Feb 2019 19:22:34 +0000 (19:22 +0000)]
bpf: disassembler support for XADD under sub-register mode

Like the other load/store instructions, "w" register is preferred when
disassembling BPF_STX | BPF_W | BPF_XADD.

v1 -> v2:
 - Updated testcase insn-unit.s (Yonghong)

Acked-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@355127 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agobpf: enable sub-register code-gen for XADD
Jiong Wang [Thu, 28 Feb 2019 19:21:28 +0000 (19:21 +0000)]
bpf: enable sub-register code-gen for XADD

Support sub-register code-gen for XADD is like supporting any other Load
and Store patterns.

No new instruction is introduced.

  lock *(u32 *)(r1 + 0) += w2

has exactly the same underlying insn as:

  lock *(u32 *)(r1 + 0) += r2

BPF_W width modifier has guaranteed they behave the same at runtime. This
patch merely teaches BPF back-end that BPF_W width modifier could work
GPR32 register class and that's all needed for sub-register code-gen
support for XADD.

test/CodeGen/BPF/xadd.ll updated to include sub-register code-gen tests.

A new testcase test/CodeGen/BPF/xadd_legal.ll is added to make sure the
legal case could pass on all code-gen modes. It could also test dead Def
check on GPR32. If there is no proper handling like what has been done
inside BPFMIChecking.cpp:hasLivingDefs, then this testcase will fail.

Acked-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@355126 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agobpf: improve dead Defs check for XADD
Jiong Wang [Thu, 28 Feb 2019 19:20:26 +0000 (19:20 +0000)]
bpf: improve dead Defs check for XADD

BPF XADD semantics require all Defs of XADD are dead, meaning any result of
XADD insn is not used.

However, BPF backend hasn't enabled sub-register liveness track, so when
the source and destination operands of XADD are GPR32, there is no
sub-register dead info. If we rely on the generic
MachineInstr::allDefsAreDead, then we will raise false alarm on GPR32 Def.
This was fine as there was no sub-register code-gen support for XADD which
will be added by the next patch.

To support GPR32 Def, ideally we could just enable sub-registr liveness
track on BPF backend, then allDefsAreDead could work on GPR32 Def. This
requires implementing TargetSubtargetInfo::enableSubRegLiveness on BPF.

However, sub-register liveness tracking module inside LLVM is actually
designed for the situation where one register could be split into more
than one sub-registers for which case each sub-register could have their
own liveness and kill one of them doesn't kill others. So, tracking
liveness for each make sense.

For BPF, each 64-bit register could only have one 32-bit sub-register. This
is exactly the case which LLVM think brings no benefits for doing
sub-register tracking, because the live range of sub-register must always
equal to its parent register, therefore liveness tracking is disabled even
the back-end has implemented enableSubRegLiveness. The detailed information
is at r232695:

  Author: Matthias Braun <matze@braunis.de>
  Date:   Thu Mar 19 00:21:58 2015 +0000
  Do not track subregister liveness when it brings no benefits

Hence, for BPF, we enhance MachineInstr::allDefsAreDead. Given the solo
sub-register always has the same liveness as its parent register, LLVM is
already attaching a implicit 64-bit register Def whenever the there is
a sub-register Def. The liveness of the implicit 64-bit Def is available.
For example, for "lock *(u32 *)(r0 + 4) += w9", the MachineOperand info
could be:

  $w9 = XADDW32 killed $r0, 4, $w9(tied-def 0),
                       implicit killed $r9, implicit-def dead $r9

Even though w9 is not marked as Dead, the parent register r9 is marked as
Dead correctly, and it is safe to use such information or our purpose.

v1 -> v2:
 - Simplified code logic inside hasLiveDefs. (Yonghong)

Acked-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@355124 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdd Support for Creating and Deleting Unicode Files and Directories in Lit
Serge Guelton [Thu, 28 Feb 2019 19:16:17 +0000 (19:16 +0000)]
Add Support for Creating and Deleting Unicode Files and Directories in Lit

This enables lit to work with unicode file names via mkdir, rm, and redirection.
Lit still uses utf-8 internally, but converts to utf-16 on Windows, or just utf-8
bytes on everything else.

Committed on behalf of Jason Mittertreiner
Differential Revision: https://reviews.llvm.org/D56754

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

5 years ago[InstCombine] fold adds of constants separated by sext/zext
Sanjay Patel [Thu, 28 Feb 2019 19:05:26 +0000 (19:05 +0000)]
[InstCombine] fold adds of constants separated by sext/zext

This is part of a transform that may be done in the backend:
D13757
...but it should always be beneficial to fold this sooner in IR
for all targets.

https://rise4fun.com/Alive/vaiW

  Name: sext add nsw
  %add = add nsw i8 %i, C0
  %ext = sext i8 %add to i32
  %r = add i32 %ext, C1
  =>
  %s = sext i8 %i to i32
  %r = add i32 %s, sext(C0)+C1

  Name: zext add nuw
  %add = add nuw i8 %i, C0
  %ext = zext i8 %add to i16
  %r = add i16 %ext, C1
  =>
  %s = zext i8 %i to i16
  %r = add i16 %s, zext(C0)+C1

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

5 years ago[X86] Add test case that was supposed to go with r355116.
Craig Topper [Thu, 28 Feb 2019 18:50:16 +0000 (18:50 +0000)]
[X86] Add test case that was supposed to go with r355116.

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

5 years ago[X86] Don't peek through bitcasts before checking ISD::isBuildVectorOfConstantSDNodes...
Craig Topper [Thu, 28 Feb 2019 18:49:29 +0000 (18:49 +0000)]
[X86] Don't peek through bitcasts before checking ISD::isBuildVectorOfConstantSDNodes in combineTruncatedArithmetic

We don't have any combines that can look through a bitcast to truncate a build vector of constants. So the truncate will stick around and give us something like this pattern (binop (trunc X), (trunc (bitcast (build_vector)))) which has two truncates in it. Which will be reversed by hoistLogicOpWithSameOpcodeHands in the generic DAG combiner. Thus causing an infinite loop.

Even if we had a combine for (truncate (bitcast (build_vector))), I think it would need to be implemented in getNode otherwise DAG combiner visit ordering would probably still visit the binop first and reverse it. Or combineTruncatedArithmetic would need to do its own constant folding.

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

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

5 years agoRevert "[AArch64][GlobalISel] Add support for 64 bit vector shuffle using TBL1."
Amara Emerson [Thu, 28 Feb 2019 18:47:29 +0000 (18:47 +0000)]
Revert "[AArch64][GlobalISel] Add support for 64 bit vector shuffle using TBL1."

Seems to break some neon intrinsics tests.

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

5 years ago[dsymutil] Use rfind for paths with parentheses
Jonas Devlieghere [Thu, 28 Feb 2019 18:46:04 +0000 (18:46 +0000)]
[dsymutil] Use rfind for paths with parentheses

Dsymutil gets library member information is through the ambiguous
/path/to/archive.a(member.o). The current logic we use would get
confused by additional parentheses. Using rfind mitigates this issue.

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

5 years ago[WebAssembly] Remove uses of ThreadModel
Thomas Lively [Thu, 28 Feb 2019 18:39:08 +0000 (18:39 +0000)]
[WebAssembly] Remove uses of ThreadModel

Summary:
In the clang UI, replaces -mthread-model posix with -matomics as the
source of truth on threading. In the backend, replaces
-thread-model=posix with the atomics target feature, which is now
collected on the WebAssemblyTargetMachine along with all other used
features. These collected features will also be used to emit the
target features section in the future.

The default configuration for the backend is thread-model=posix and no
atomics, which was previously an invalid configuration. This change
makes the default valid because the thread model is ignored.

A side effect of this change is that objects are never emitted with
passive segments. It will instead be up to the linker to decide
whether sections should be active or passive based on whether atomics
are used in the final link.

Reviewers: aheejin, sbc100, dschuff

Subscribers: mehdi_amini, jgravelle-google, hiraditya, sunfish, steven_wu, dexonsmith, rupprecht, jfb, jdoerfert, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years ago[Tests] Strengthen LICM test corpus to show alignment striping. (part 2)
Philip Reames [Thu, 28 Feb 2019 18:17:51 +0000 (18:17 +0000)]
[Tests] Strengthen LICM test corpus to show alignment striping. (part 2)

This should have been part of r355110, but my brain isn't quite awake yet, despite the coffee.  Per the original submit comment... Doing scalar promotion w/o being able to prove the alignment of the hoisted load or sunk store is a bug.  Update tests to actually show the alignment so that impact of the patch which fixes this can be seen.

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

5 years ago[Tests] Strengthen LICM test corpus to show alignment striping
Philip Reames [Thu, 28 Feb 2019 18:08:04 +0000 (18:08 +0000)]
[Tests] Strengthen LICM test corpus to show alignment striping

Doing scalar promotion w/o being able to prove the alignment of the hoisted load or sunk store is a bug.  Update tests to actually show the alignment so that impact of the patch which fixes this can be seen.

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

5 years ago[ValueTracking] More accurate unsigned sub overflow detection
Nikita Popov [Thu, 28 Feb 2019 18:04:20 +0000 (18:04 +0000)]
[ValueTracking] More accurate unsigned sub overflow detection

Second part of D58593.

Compute precise overflow conditions based on all known bits, rather
than just the sign bits. Unsigned a - b overflows iff a < b, and we
can determine whether this always/never happens based on the minimal
and maximal values achievable for a and b subject to the known bits
constraint.

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

5 years agollvm-config: Include -stdlib= in --cxxflags
Tom Stellard [Thu, 28 Feb 2019 17:31:59 +0000 (17:31 +0000)]
llvm-config: Include -stdlib= in --cxxflags

Summary:
This was removed in r349068, but it is needed when llvm is compiled
using the non-default c++ standard library on a platform.

Reviewers: sylvestre.ledru, infinity0, mgorny, cuviper

Reviewed By: sylvestre.ledru

Subscribers: jdoerfert, llvm-commits

Tags: #llvm

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

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

5 years agoMake MergeBlockIntoPredecessor conformant to the precondition of calling DTU.applyUpdates
Chijun Sima [Thu, 28 Feb 2019 16:47:18 +0000 (16:47 +0000)]
Make MergeBlockIntoPredecessor conformant to the precondition of calling DTU.applyUpdates

Summary:
It is mentioned in the document of DTU that "It is illegal to submit any update that has already been submitted, i.e., you are supposed not to insert an existent edge or delete a nonexistent edge." It is dangerous to violet this rule because DomTree and PostDomTree occasionally crash on this scenario.

This patch fixes `MergeBlockIntoPredecessor`, making it conformant to this precondition.

Reviewers: kuhar, brzycki, chandlerc

Reviewed By: brzycki

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[AArch64][GlobalISel] Add support for 64 bit vector shuffle using TBL1.
Amara Emerson [Thu, 28 Feb 2019 16:43:11 +0000 (16:43 +0000)]
[AArch64][GlobalISel] Add support for 64 bit vector shuffle using TBL1.

This extends the existing support for shufflevector to handle cases like
<2 x float>, which we can implement by concating the vectors and using a TBL1.

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

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

5 years ago[Target][ARM] Add a usage for SrcSz to unbreak build-bots without assertions
Kadir Cetinkaya [Thu, 28 Feb 2019 15:55:11 +0000 (15:55 +0000)]
[Target][ARM] Add a usage for SrcSz to unbreak build-bots without assertions

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

5 years agoAdd support for computing "zext of value" in KnownBits. NFCI
Bjorn Pettersson [Thu, 28 Feb 2019 15:45:29 +0000 (15:45 +0000)]
Add support for computing "zext of value" in KnownBits. NFCI

Summary:
The description of KnownBits::zext() and
KnownBits::zextOrTrunc() has confusingly been telling
that the operation is equivalent to zero extending the
value we're tracking. That has not been true, instead
the user has been forced to explicitly set the extended
bits as known zero afterwards.

This patch adds a second argument to KnownBits::zext()
and KnownBits::zextOrTrunc() to control if the extended
bits should be considered as known zero or as unknown.

Reviewers: craig.topper, RKSimon

Reviewed By: RKSimon

Subscribers: javed.absar, hiraditya, jdoerfert, llvm-commits

Tags: #llvm

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

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

5 years ago[PowerPC] Removed STATISTIC that was causing build errors.
Stefan Pintilie [Thu, 28 Feb 2019 12:40:28 +0000 (12:40 +0000)]
[PowerPC] Removed STATISTIC that was causing build errors.

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

5 years ago[PowerPC] Move the stack pointer update instruction later in the prologue and earlier...
Stefan Pintilie [Thu, 28 Feb 2019 12:23:28 +0000 (12:23 +0000)]
[PowerPC] Move the stack pointer update instruction later in the prologue and earlier in the epilogue.

Move the stdu instruction in the prologue and epilogue.
This should provide a small performance boost in functions that are able to do
this. I've kept this change rather conservative at the moment and functions
with frame pointers or base pointers will not try to move the stack pointer
update.

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

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

5 years ago[X86][AVX] Remove superfluous insert_subvector(zero, bitcast(x)) -> bitcast(insert_su...
Simon Pilgrim [Thu, 28 Feb 2019 11:39:52 +0000 (11:39 +0000)]
[X86][AVX] Remove superfluous insert_subvector(zero, bitcast(x)) -> bitcast(insert_subvector(zero, x)) fold

This is caught by other existing bitcast folds.

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

5 years ago[ARM GlobalISel] Make arm_i32imm an IntImmLeaf
Diana Picus [Thu, 28 Feb 2019 11:13:05 +0000 (11:13 +0000)]
[ARM GlobalISel] Make arm_i32imm an IntImmLeaf

This gets rid of some duplication in the TableGen definition, but it
forces us to keep both a pointer and a reference to the subtarget in the
ARMInstructionSelector. That is pretty ugly but it might be a reasonable
trade-off, since the TableGen descriptions should outlive the code in
the selector (or in the worst case we can update to use just the
reference when we get rid of DAGISel).

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

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

5 years agoFixed typos in a test: s/CEHCK/CHECK/
Dmitri Gribenko [Thu, 28 Feb 2019 10:58:13 +0000 (10:58 +0000)]
Fixed typos in a test: s/CEHCK/CHECK/

Reviewers: ilya-biryukov, serge-sans-paille

Subscribers: delcypher, llvm-commits

Tags: #llvm

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

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

5 years agoFixed a typo in the test s/CEHCK/CHECK/
Dmitri Gribenko [Thu, 28 Feb 2019 10:56:39 +0000 (10:56 +0000)]
Fixed a typo in the test s/CEHCK/CHECK/

Summary:
Turns out the test was not correct, I had to adjust the test to work.  I
also added CHECK-LABELs for better error messages from FileCheck while
I'm here.

Reviewers: jsji

Subscribers: nemanjai, eraman, llvm-commits

Tags: #llvm

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

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

5 years ago[X86][AVX] Fold vf64 concat_vectors(movddup(x),movddup(x)) -> broadcast(x)
Simon Pilgrim [Thu, 28 Feb 2019 10:53:58 +0000 (10:53 +0000)]
[X86][AVX] Fold vf64 concat_vectors(movddup(x),movddup(x)) -> broadcast(x)

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

5 years ago[ARM GlobalISel] Support global variables for Thumb2
Diana Picus [Thu, 28 Feb 2019 10:42:47 +0000 (10:42 +0000)]
[ARM GlobalISel] Support global variables for Thumb2

Add the same level of support as for ARM mode (i.e. still no TLS
support).

In most cases, it is sufficient to replace the opcodes with the
t2-equivalent, but there are some idiosyncrasies that I decided to
preserve because I don't understand the full implications:
* For ARM we use LDRi12 to load from constant pools, but for Thumb we
  use t2LDRpci (I'm not sure if the ideal would be to use t2LDRi12 for
  Thumb as well, or to use LDRcp for ARM).
* For Thumb we don't have an equivalent for MOV|LDRLIT_ga_pcrel_ldr, so
  we have to generate MOV|LDRLIT_ga_pcrel plus a load from GOT.

The tests are in separate files because they're hard enough to read even
without doubling the number of checks.

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

5 years ago[llvm-objdump] - Improve the error message for "removing a section that is used by...
George Rimar [Thu, 28 Feb 2019 08:21:50 +0000 (08:21 +0000)]
[llvm-objdump] - Improve the error message for "removing a section that is used by relocation" case.

This refines/improves the error message introduced in D58625

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

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

5 years ago[llvm-readobj] - Fix the invalid dumping of the dynamic sections without terminating...
George Rimar [Thu, 28 Feb 2019 08:15:59 +0000 (08:15 +0000)]
[llvm-readobj] - Fix the invalid dumping of the dynamic sections without terminating DT_NULL entry.

This is https://bugs.llvm.org/show_bug.cgi?id=40861,

Previously llvm-readobj would print the DT_NULL sometimes
for the dynamic section that has no terminator entry.

The logic of printDynamicTable was a bit overcomplicated.
I rewrote it slightly to fix the issue and commented.

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

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

5 years ago[ValueTracking] More accurate unsigned add overflow detection
Nikita Popov [Thu, 28 Feb 2019 08:11:20 +0000 (08:11 +0000)]
[ValueTracking] More accurate unsigned add overflow detection

Part of D58593.

Compute precise overflow conditions based on all known bits, rather
than just the sign bits. Unsigned a + b overflows iff a > ~b, and we
can determine whether this always/never happens based on the minimal
and maximal values achievable for a and ~b subject to the known bits
constraint.

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

5 years ago[X86] Use PreprocessISelDAG to convert vector sra/srl/shl to the X86 specific variabl...
Craig Topper [Thu, 28 Feb 2019 07:21:26 +0000 (07:21 +0000)]
[X86] Use PreprocessISelDAG to convert vector sra/srl/shl to the X86 specific variable shift ISD opcodes.

These allows use to use the same set of isel patterns for sra/srl/shl which are undefined for out of range shifts and intrinsic shifts which aren't undefined.

Doing this late allows DAG combine to have every opportunity to optimize the sra/srl/shl nodes.

This removes about 7000 bytes from the isel table and simplies the td files.

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

5 years ago[Dominators] Avoid potentially quadratic std::is_permutation
Fangrui Song [Thu, 28 Feb 2019 05:16:01 +0000 (05:16 +0000)]
[Dominators] Avoid potentially quadratic std::is_permutation

Summary:
If the two sequences are not equal, std::is_permutation may be O(N^2)
and indeed the case in libstdc++ and libc++. Use SmallPtrSet to prevent
pessimizing cases. On my machine, SmallPtrSet starts to outperform
std::is_permutation when there are 16 elements.

Reviewers: kuhar

Reviewed By: kuhar

Subscribers: kristina, jdoerfert, llvm-commits

Tags: #llvm

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

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

5 years ago[SelectionDAG] Strengthen assertions about usage of AtomicSDNodes
Philip Reames [Thu, 28 Feb 2019 04:07:23 +0000 (04:07 +0000)]
[SelectionDAG] Strengthen assertions about usage of AtomicSDNodes

In D57601, I described the expectations around usage of AtomicSDNode and LoadSDNode/StoreSDNode w.r.t. atomic and volatiles. This patch simply embeds those expectations in assertions so that they can't be accidentally weakened.

Note: The reason only AtomicSDNodes of ATOMIC_LOAD and ATOMIC_STORE opcode are currently checked is that AMDGPU has an intrinsic which gets lowered to an ATOMIC_LOAD_FADD w/o a corresponding atomic MMO. This is suspicious, and I've brought it to the attention of the relevant developers. Once resolved, I'll strengthen that assertion.

Note 2: If this breaks your out-of-tree backend, go read the update instructions associated w/the previously mentioned patch. This will assert on (a subset of) things you need to update per those instructions.

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

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

5 years agoFix IR/Analysis layering issue with OptBisect
Richard Trieu [Thu, 28 Feb 2019 04:00:55 +0000 (04:00 +0000)]
Fix IR/Analysis layering issue with OptBisect

OptBisect is in IR due to LLVMContext using it.  However, it uses IR units from
Analysis as well.  This change moves getDescription functions from OptBisect
to their respective IR units.  Generating names for IR units will now be up
to the callers, keeping the Analysis IR units in Analysis.  To prevent
unnecessary string generation, isEnabled function is added so that callers know
when the description needs to be generated.

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

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

5 years agoFix SupportTests.exe/AllocationTests/MappedMemoryTest.AllocAndReleaseHuge when the...
Alexandre Ganea [Thu, 28 Feb 2019 03:42:07 +0000 (03:42 +0000)]
Fix SupportTests.exe/AllocationTests/MappedMemoryTest.AllocAndReleaseHuge when the machine doesn't have large pages enabled.

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

5 years agoFix non-Windows platforms build break introduced by r355065. Fixes:
Alexandre Ganea [Thu, 28 Feb 2019 03:03:07 +0000 (03:03 +0000)]
Fix non-Windows platforms build break introduced by r355065. Fixes:

In file included from /home/buildbots/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm/lib/Support/Memory.cpp:14:
/home/buildbots/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm/include/llvm/Support/Memory.h:38:14: error: private field 'Flags' is not used [-Werror,-Wunused-private-field]
    unsigned Flags = 0;
             ^
1 error generated.

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

5 years ago[Memory] Add basic support for large/huge memory pages
Alexandre Ganea [Thu, 28 Feb 2019 02:47:34 +0000 (02:47 +0000)]
[Memory] Add basic support for large/huge memory pages

This patch introduces Memory::MF_HUGE_HINT which indicates that allocateMappedMemory() shall return a pointer to a large memory page.
However the flag is a hint because we're not guaranteed in any way that we will get back a large memory page. There are several restrictions:

- Large/huge memory pages aren't enabled by default on modern OSes (Windows 10 and Linux at least), and should be manually enabled/reserved.
- Once enabled, it should be kept in mind that large pages are physical only, they can't be swapped.
- Memory fragmentation can affect the availability of large pages, especially after running the OS for a long time and/or running along many other applications.

Memory::allocateMappedMemory() will fallback to 4KB pages if it can't allocate 2MB large pages (if Memory::MF_HUGE_HINT is provided)

Currently, Memory::MF_HUGE_HINT only works on Windows. The hint will be ignored on Linux, 4KB pages will always be returned.

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

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

5 years agoTemporarily revert "ArgumentPromotion should copy all metadata to new Function" and...
Eric Christopher [Thu, 28 Feb 2019 01:11:12 +0000 (01:11 +0000)]
Temporarily revert "ArgumentPromotion should copy all metadata to new Function" and the dependent patch "Refine ArgPromotion metadata handling" as they're causing segfaults in argument promotion.

This reverts commits r354032 and r353537.

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

5 years ago[X86] Use X86::LAST_VALID_COND instead of assuming X86::COND_S is the last encoding...
Craig Topper [Thu, 28 Feb 2019 01:00:31 +0000 (01:00 +0000)]
[X86] Use X86::LAST_VALID_COND instead of assuming X86::COND_S is the last encoding. NFC

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

5 years agoAMDGPU/GlobalISel: Add regbankselect test for phis
Matt Arsenault [Thu, 28 Feb 2019 00:52:36 +0000 (00:52 +0000)]
AMDGPU/GlobalISel: Add regbankselect test for phis

Add baseline for future fixes. These mostly show how this is broken
and producing illegal situations.

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

5 years agoAMDGPU: Fix typo
Matt Arsenault [Thu, 28 Feb 2019 00:52:33 +0000 (00:52 +0000)]
AMDGPU: Fix typo

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

5 years agoAMDGPU: Enable function calls by default
Matt Arsenault [Thu, 28 Feb 2019 00:40:32 +0000 (00:40 +0000)]
AMDGPU: Enable function calls by default

Fixes some crashes on illegal call situations which are unfortunately
still valid IR.

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

5 years ago[AArch64] Generate FP16 vector compare instructions.
Abderrazek Zaafrani [Thu, 28 Feb 2019 00:31:38 +0000 (00:31 +0000)]
[AArch64] Generate FP16 vector compare instructions.
https://reviews.llvm.org/D58561

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

5 years agoAMDGPU: Fix crashes in invalid call cases
Matt Arsenault [Thu, 28 Feb 2019 00:28:44 +0000 (00:28 +0000)]
AMDGPU: Fix crashes in invalid call cases

We have to at least tolerate calls to kernels, possibly with a
mismatched calling convention on the callsite.

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

5 years agoGlobalISel: Implement fewerElementsVector for phi
Matt Arsenault [Thu, 28 Feb 2019 00:16:32 +0000 (00:16 +0000)]
GlobalISel: Implement fewerElementsVector for phi

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

5 years agoGlobalISel: Implement moreElementsVector for phi
Matt Arsenault [Thu, 28 Feb 2019 00:01:05 +0000 (00:01 +0000)]
GlobalISel: Implement moreElementsVector for phi

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

5 years ago[InstrProf] Use separate comdat group for data and counters
Reid Kleckner [Wed, 27 Feb 2019 23:38:44 +0000 (23:38 +0000)]
[InstrProf] Use separate comdat group for data and counters

Summary:
I hadn't realized that instrumentation runs before inlining, so we can't
use the function as the comdat group. Doing so can create relocations
against discarded sections when references to discarded __profc_
variables are inlined into functions outside the function's comdat
group.

In the future, perhaps we should consider standardizing the comdat group
names that ELF and COFF use. It will save object file size, since
__profv_$sym won't appear in the symbol table again.

Reviewers: xur, vsk

Subscribers: eraman, hiraditya, cfe-commits, #sanitizers, llvm-commits

Tags: #clang, #sanitizers, #llvm

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

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

5 years ago[MemorySSA] Make insertDef insert corresponding phi nodes.
Alina Sbirlea [Wed, 27 Feb 2019 22:20:22 +0000 (22:20 +0000)]
[MemorySSA] Make insertDef insert corresponding phi nodes.

Summary:
The original assumption for the insertDef method was that it would not
materialize Defs out of no-where, hence it will not insert phis needed
after inserting a Def.

However, when cloning an instruction (use case used in LICM), we do
materialize Defs "out of no-where". If the block receiving a Def has at
least one other Def, then no processing is needed. If the block just
received its first Def, we must check where Phi placement is needed.
The only new usage of insertDef is in LICM, hence the trigger for the bug.

But the original goal of the method also fails to apply for the move()
method. If we move a Def from the entry point of a diamond to either the
left or right blocks, then the merge block must add a phi.
While this usecase does not currently occur, or may be viewed as an
incorrect transformation, MSSA must behave corectly given the scenario.

Resolves PR40749 and PR40754.

Reviewers: george.burgess.iv

Subscribers: sanjoy, jlebar, Prazek, jdoerfert, llvm-commits

Tags: #llvm

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

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

5 years agoDefault to Secure PLT on PPC for NetBSD and OpenBSD.
Joerg Sonnenberger [Wed, 27 Feb 2019 21:53:14 +0000 (21:53 +0000)]
Default to Secure PLT on PPC for NetBSD and OpenBSD.
This matches the default settings of clang.

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

5 years agoFixup compilation/test failures after r354960 and r355013.
James Y Knight [Wed, 27 Feb 2019 21:47:35 +0000 (21:47 +0000)]
Fixup compilation/test failures after r354960 and r355013.

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

5 years ago[llvm-cxxfilt] Re-enable split and demangle stdin input on certain non-alphanumerics.
Matt Davis [Wed, 27 Feb 2019 21:39:11 +0000 (21:39 +0000)]
[llvm-cxxfilt] Re-enable split and demangle stdin input on certain non-alphanumerics.

This restores the patch that splits demangled stdin input on
non-alphanumerics.  I had reverted this patch earlier because it broke
Windows build-bots.  I have updated the test so that it passes on
Windows.

I was running the test from powershell and never saw the issue until I
switched to the mingw shell.

This reverts commit 628ab5c6820bdf3bb5a8e494b0fd9e7312ce7150.

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

5 years ago[hwasan, asan] Intercept vfork.
Evgeniy Stepanov [Wed, 27 Feb 2019 21:11:50 +0000 (21:11 +0000)]
[hwasan, asan] Intercept vfork.

Summary:
Intercept vfork on arm, aarch64, i386 and x86_64.

Reviewers: pcc, vitalybuka

Subscribers: kubamracek, mgorny, javed.absar, krytarowski, kristof.beyls, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

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

5 years agoSeperate volatility and atomicity/ordering in SelectionDAG
Philip Reames [Wed, 27 Feb 2019 20:20:08 +0000 (20:20 +0000)]
Seperate volatility and atomicity/ordering in SelectionDAG

At the moment, we mark every atomic memory access as being also volatile. This is unnecessarily conservative and prohibits many legal transforms (DCE, folding, etc..).

This patch removes MOVolatile from the MachineMemOperands of atomic, but not volatile, instructions. This should be strictly NFC after a series of previous patches which have gone in to ensure backend code is conservative about handling of isAtomic MMOs. Once it's in and baked for a bit, we'll start working through removing unnecessary bailouts one by one. We applied this same strategy to the middle end a few years ago, with good success.

To make sure this patch itself is NFC, it is build on top of a series of other patches which adjust code to (for the moment) be as conservative for an atomic access as for a volatile access and build up a test corpus (mostly in test/CodeGen/X86/atomics-unordered.ll)..

Previously landed

    D57593 Fix a bug in the definition of isUnordered on MachineMemOperand
    D57596 [CodeGen] Be conservative about atomic accesses as for volatile
    D57802 Be conservative about unordered accesses for the moment
    rL353959: [Tests] First batch of cornercase tests for unordered atomics.
    rL353966: [Tests] RMW folding tests w/unordered atomic operations.
    rL353972: [Tests] More unordered atomic lowering tests.
    rL353989: [SelectionDAG] Inline a single use helper function, and remove last non-MMO interface
    rL354740: [Hexagon, SystemZ] Be super conservative about atomics
    rL354800: [Lanai] Be super conservative about atomics
    rL354845: [ARM] Be super conservative about atomics

Attention Out of Tree Backend Owners: This patch may break you. If it does, you can use the TLI getMMOFlags hook to restore the MOVolatile to any instruction you need to. (See llvm-dev thread titled "PSA: Changes to how atomics are handled in backends" started Feb 27, 2019.)

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

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

5 years agoFixed ubsan failures in r355005.
Rong Xu [Wed, 27 Feb 2019 20:01:14 +0000 (20:01 +0000)]
Fixed ubsan failures in r355005.

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

5 years agoRevert "[llvm-cxxfilt] Split and demangle stdin input on certain non-alphanumerics."
Matt Davis [Wed, 27 Feb 2019 19:52:02 +0000 (19:52 +0000)]
Revert "[llvm-cxxfilt] Split and demangle stdin input on certain non-alphanumerics."

This reverts commit 5cd5f8f2563395f8767f94604eb4c4bea8dcbea0.
The test passes on linux, but fails on the windows build-bots.

This test failure seems to be a quoting issue between my test and
FileCheck on Windows.  I'm reverting this patch until I can replicate
and fix in my Windows environment.

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

5 years ago[InstCombine] add tests for add+ext+add; NFC
Sanjay Patel [Wed, 27 Feb 2019 19:27:45 +0000 (19:27 +0000)]
[InstCombine] add tests for add+ext+add; NFC

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

5 years ago[X86][AVX] Pull out some INSERT_SUBVECTOR combines into a combineConcatVectorOps...
Simon Pilgrim [Wed, 27 Feb 2019 18:46:32 +0000 (18:46 +0000)]
[X86][AVX] Pull out some INSERT_SUBVECTOR combines into a combineConcatVectorOps helper. NFCI

A lot of the INSERT_SUBVECTOR combines can be more generally handled as if they have come from a CONCAT_VECTORS node.

I've been investigating adding a CONCAT_VECTORS combine to X86, but this is a much easier first step that avoids the issue of handling a number of pre-legalization issues that I've encountered.

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

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

5 years ago[llvm-readobj] Print section type values for unknown sections.
Matt Davis [Wed, 27 Feb 2019 18:39:17 +0000 (18:39 +0000)]
[llvm-readobj] Print section type values for unknown sections.

Summary:
This patch displays a hexadecimal section value (Elf_Shdr::sh_type) or section-relative offset when printing unknown sections.

Here is a subset of the output (ignoring the fields following "Type" when dumping an ELF's GNU `--section-headers` table).
Section Headers:
```
  [Nr] Name              Type
  [16] android_rel       LOOS+0x1
  [17] android_rela      LOOS+0x2
  [27] unknown           0x1000: <unknown>
  [28] loos              LOOS+0
  [30] hios              VERSYM
  [31] loproc            LOPROC+0
  [33] hiproc            LOPROC+0xFFFFFFF
  [34] louser            LOUSER+0
  [36] hiuser            LOUSER+0x7FFFFFFF
```

As a comparison, the previous output looked something like the above, but with a blank "Type" field:
```
  [Nr] Name              Type
  [27] unknown
  [28] loos
  [30] hios              VERSYM
  [31] loproc
  [33] hiproc
  [34] louser
  [36] hiuser
```

This fixes PR40773

Reviewers: jhenderson, rupprecht, Bigcheese

Reviewed By: jhenderson, rupprecht, Bigcheese

Subscribers: MaskRay, Bigcheese, srhines, jdoerfert, llvm-commits

Tags: #llvm

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

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

5 years ago Attempt to fix buildbot after r354972 [#1]. NFCI.
Alexey Lapshin [Wed, 27 Feb 2019 18:36:46 +0000 (18:36 +0000)]
Attempt to fix buildbot after r354972 [#1]. NFCI.

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

5 years ago[llvm-cxxfilt] Re-enable the delimiters test on Windows.
Matt Davis [Wed, 27 Feb 2019 18:04:21 +0000 (18:04 +0000)]
[llvm-cxxfilt] Re-enable the delimiters test on Windows.

The original intent was to enable this test for Windows; however, that
initial patch broke one of the build-bots.  I temporarily disabled this
test on Windows until that issue was resolved.  It was resolved in my
previous patch (cfd1d9742ee2d1b8dd6b7), and now I am re-enabling this
test.

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

5 years agoClean up the delimiters test.
Matt Davis [Wed, 27 Feb 2019 17:39:36 +0000 (17:39 +0000)]
Clean up the delimiters test.

Ideally this is a NFCI, used single quotes in most cases.  Hopefully
this will make the Windows bot happy.

I've marked this unsupported on windows, until I get my windows box
setup with this patch to test.  I'll remove that constraint after I'm
confident this will pass on windows.  I just want to silence the
buildbots for now.

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

5 years agoRecommit r354930 "[PGO] Context sensitive PGO (part 1)"
Rong Xu [Wed, 27 Feb 2019 17:24:33 +0000 (17:24 +0000)]
Recommit r354930 "[PGO] Context sensitive PGO (part 1)"

Fixed UBSan failures.

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

5 years ago[llvm-readobj]Add additional testing for various ELF features
James Henderson [Wed, 27 Feb 2019 16:41:59 +0000 (16:41 +0000)]
[llvm-readobj]Add additional testing for various ELF features

This patch adds testing of areas of the code that are not fully tested,
in particular dynamic table printing, ELF type printing, handling of
edge cases where things are missing/empty (relocations/program header
tables/section header table), and the --string-dump switch.

Reviewed by: grimar, higuoxing, rupprecht

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

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

5 years ago[llvm-objdump] Should print strings when dumping DT_RPATH, DT_RUNPATH, DT_SONAME...
Xing GUO [Wed, 27 Feb 2019 16:37:15 +0000 (16:37 +0000)]
[llvm-objdump] Should print strings when dumping DT_RPATH, DT_RUNPATH, DT_SONAME, DT_AUXILIARY and DT_FILTER tags in dynamic section.

Summary:
Before:
```
Dynamic Section:
  NEEDED               libpthread.so.0
  ...
  NEEDED               ld-linux-x86-64.so.2
  RPATH                0x00000000001c2e61
```

After:
```
Dynamic Section:
  NEEDED               libpthread.so.0
  ...
  NEEDED               ld-linux-x86-64.so.2
  RPATH                $ORIGIN/../lib
```

Only a small problem here, I have no idea on choosing test case. I see there's a test
file(test/tools/llvm-objdump/private-headers-dynamic-section.test). But it has no DT_RPATH and DT_RUNPATH tags. Shall I replace the ELF file in the
Inputs dir by a new one?

Reviewers: jhenderson, grimar

Reviewed By: jhenderson

Subscribers: srhines, rupprecht, jfb, llvm-commits

Tags: #llvm

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

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

5 years ago[llvm-cxxfilt] Split and demangle stdin input on certain non-alphanumerics.
Matt Davis [Wed, 27 Feb 2019 16:29:50 +0000 (16:29 +0000)]
[llvm-cxxfilt] Split and demangle stdin input on certain non-alphanumerics.

Summary:
This patch attempts to replicate GNU c++-filt behavior when splitting stdin input for demangling.

Previously, cxx-filt would split input only on spaces.  Each delimited item is then demangled.
From what I have tested, GNU c++filt also splits input on any character that does not make
up the mangled name (notably commas, but also a large set of non-alphanumeric characters).

This patch splits stdin input on any character that does not belong to the Itanium mangling
format (since Itanium is currently the only supported format in llvm-cxxfilt).

This is an update to PR39990

Reviewers: jhenderson, tejohnson, compnerd

Reviewed By: compnerd

Subscribers: erik.pilkington, llvm-commits

Tags: #llvm

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

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

5 years ago[InstCombine] Add additional add.sat overflow tests; NFC
Nikita Popov [Wed, 27 Feb 2019 16:18:29 +0000 (16:18 +0000)]
[InstCombine] Add additional add.sat overflow tests; NFC

Baseline for D58593.

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

5 years ago[InstCombine] regenerate complete checks; NFC
Sanjay Patel [Wed, 27 Feb 2019 15:59:30 +0000 (15:59 +0000)]
[InstCombine] regenerate complete checks; NFC

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

5 years agogn build: Merge r354989
Nico Weber [Wed, 27 Feb 2019 15:46:51 +0000 (15:46 +0000)]
gn build: Merge r354989

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

5 years agogn build: Merge r354692
Nico Weber [Wed, 27 Feb 2019 15:29:14 +0000 (15:29 +0000)]
gn build: Merge r354692

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

5 years ago[DebugInfo] Apply subprogram attributes on behalf of owner CU
Eugene Leviant [Wed, 27 Feb 2019 14:46:59 +0000 (14:46 +0000)]
[DebugInfo] Apply subprogram attributes on behalf of owner CU

When using full LTO it is possible that template function definition DIE
is bound to one compilation unit and it's declaration to another. We should
add function declaration attributes on behalf of its owner CU otherwise
we may end up with malformed file identifier in function declaration
DW_AT_decl_file attribute.

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

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

5 years ago[AMDGPU][MC] Added register size check for VOP3/SDWA/DPP operands
Dmitry Preobrazhensky [Wed, 27 Feb 2019 13:58:48 +0000 (13:58 +0000)]
[AMDGPU][MC] Added register size check for VOP3/SDWA/DPP operands

See bug 37943: https://bugs.llvm.org/show_bug.cgi?id=37943

Reviewers: artem.tamazov, arsenm, rampitec

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

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

5 years ago[DebugInfo] add SectionedAddress to DebugInfo interfaces.
Alexey Lapshin [Wed, 27 Feb 2019 13:17:36 +0000 (13:17 +0000)]
[DebugInfo] add SectionedAddress to DebugInfo interfaces.

      That patch is the fix for https://bugs.llvm.org/show_bug.cgi?id=40703
   "wrong line number info for obj file compiled with -ffunction-sections"
   bug. The problem happened with only .o files. If object file contains
   several .text sections then line number information showed incorrectly.
   The reason for this is that DwarfLineTable could not detect section which
   corresponds to specified address(because address is the local to the
   section). And as the result it could not select proper sequence in the
   line table. The fix is to pass SectionIndex with the address. So that it
   would be possible to differentiate addresses from various sections. With
   this fix llvm-objdump shows correct line numbers for disassembled code.

   Differential review: https://reviews.llvm.org/D58194

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

5 years ago[AMDGPU][MC][GFX8+] Added syntactic sugar for 'vgpr index' operand of instructions...
Dmitry Preobrazhensky [Wed, 27 Feb 2019 13:12:12 +0000 (13:12 +0000)]
[AMDGPU][MC][GFX8+] Added syntactic sugar for 'vgpr index' operand of instructions s_set_gpr_idx_on and s_set_gpr_idx_mode

See bug 39331: https://bugs.llvm.org/show_bug.cgi?id=39331

Reviewers: artem.tamazov, arsenm

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

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

5 years ago[llvm-objcopy] - Check for invalidated relocations when removing a section.
George Rimar [Wed, 27 Feb 2019 11:18:27 +0000 (11:18 +0000)]
[llvm-objcopy] - Check for invalidated relocations when removing a section.

This is https://bugs.llvm.org/show_bug.cgi?id=40818

Removing a section that is used by relocation is an error
we did not report. The patch fixes that.

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

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

5 years ago[X86][AVX] Only combine loads to broadcasts for legal types
Simon Pilgrim [Wed, 27 Feb 2019 11:17:25 +0000 (11:17 +0000)]
[X86][AVX] Only combine loads to broadcasts for legal types

Thanks to @echristo for spotting this.

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

5 years ago[llvm-readobj]Fix error messages for bad archive members and add testing for archive...
James Henderson [Wed, 27 Feb 2019 11:07:08 +0000 (11:07 +0000)]
[llvm-readobj]Fix error messages for bad archive members and add testing for archive handling

llvm-readobj's error messages were broken for bad archive members. This
patch fixes them, and also adds testing for archive and thin archive
handling within llvm-readobj.

Reviewed by: rupprecht, grimar, higuoxing

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

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

5 years agoFix Wenum-compare gcc7 warning. NFCI.
Simon Pilgrim [Wed, 27 Feb 2019 10:19:53 +0000 (10:19 +0000)]
Fix Wenum-compare gcc7 warning. NFCI.

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

5 years ago[llvm-readobj] Print DF_1_DISPRELPND
Fangrui Song [Wed, 27 Feb 2019 05:37:11 +0000 (05:37 +0000)]
[llvm-readobj] Print DF_1_DISPRELPND

The test will be added by D58677.

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

5 years ago[BPF] Don't fail for static variables
Yonghong Song [Wed, 27 Feb 2019 05:36:15 +0000 (05:36 +0000)]
[BPF] Don't fail for static variables

Currently, the LLVM will print an error like
  Unsupported relocation: try to compile with -O2 or above,
  or check your static variable usage
if user defines more than one static variables in a single
ELF section (e.g., .bss or .data).

There is ongoing effort to support static and global
variables in libbpf and kernel. This patch removed the
assertion so user programs with static variables won't
fail compilation.

The static variable in-section offset is written to
the "imm" field of the corresponding to-be-relocated
bpf instruction. Below is an example to show how the
application (e.g., libbpf) can relate variable to relocations.

  -bash-4.4$ cat g1.c
  static volatile long a = 2;
  static volatile int b = 3;
  int test() { return a + b; }
  -bash-4.4$ clang -target bpf -O2 -c g1.c
  -bash-4.4$ llvm-readelf -r g1.o

  Relocation section '.rel.text' at offset 0x158 contains 2 entries:
      Offset             Info             Type               Symbol's Value  Symbol's Name
  0000000000000000  0000000400000001 R_BPF_64_64            0000000000000000 .data
  0000000000000018  0000000400000001 R_BPF_64_64            0000000000000000 .data
  -bash-4.4$ llvm-readelf -s g1.o

  Symbol table '.symtab' contains 6 entries:
     Num:    Value          Size Type    Bind   Vis      Ndx Name
       0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
       1: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS g1.c
       2: 0000000000000000     8 OBJECT  LOCAL  DEFAULT    4 a
       3: 0000000000000008     4 OBJECT  LOCAL  DEFAULT    4 b
       4: 0000000000000000     0 SECTION LOCAL  DEFAULT    4
       5: 0000000000000000    64 FUNC    GLOBAL DEFAULT    2 test
  -bash-4.4$ llvm-objdump -d g1.o

  g1.o:   file format ELF64-BPF

  Disassembly of section .text:
  0000000000000000 test:
       0:       18 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00         r1 = 0 ll
       2:       79 11 00 00 00 00 00 00         r1 = *(u64 *)(r1 + 0)
       3:       18 02 00 00 08 00 00 00 00 00 00 00 00 00 00 00         r2 = 8 ll
       5:       61 20 00 00 00 00 00 00         r0 = *(u32 *)(r2 + 0)
       6:       0f 10 00 00 00 00 00 00         r0 += r1
       7:       95 00 00 00 00 00 00 00         exit
  -bash-4.4$

  . from symbol table, static variable "a" is in section #4, offset 0.
  . from symbol table, static variable "b" is in section #4, offset 8.
  . the first relocation is against symbol #4:
    4: 0000000000000000     0 SECTION LOCAL  DEFAULT    4
    and in-section offset 0 (see llvm-objdump result)
  . the second relocation is against symbol #4:
    4: 0000000000000000     0 SECTION LOCAL  DEFAULT    4
    and in-section offset 8 (see llvm-objdump result)
  . therefore, the first relocation is for variable "a", and
    the second relocation is for variable "b".

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

5 years agoRevert "[PGO] Context sensitive PGO (part 1)"
Vlad Tsyrklevich [Wed, 27 Feb 2019 03:45:28 +0000 (03:45 +0000)]
Revert "[PGO] Context sensitive PGO (part 1)"

This reverts commit r354930, it was causing UBSan failures.

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

5 years agoSupport: enable backtraces on Windows
Saleem Abdulrasool [Wed, 27 Feb 2019 03:21:50 +0000 (03:21 +0000)]
Support: enable backtraces on Windows

Some platforms, e.g. Windows, support backtraces but don't have
BACKTRACE. Checking for BACKTRACE prevents Windows from having
backtraces.

Patch by Jason Mittertreiner!

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

5 years ago[WebAssembly] Fix ScopeTops info in CFGStackify for EH pads
Heejin Ahn [Wed, 27 Feb 2019 01:35:14 +0000 (01:35 +0000)]
[WebAssembly] Fix ScopeTops info in CFGStackify for EH pads

Summary:
When creating `ScopeTops` info for `try` ~ `catch` ~ `end_try`, we
should create not only `end_try` -> `try` mapping but also `catch` ->
`try` mapping as well. If this is not created, `block` and `end_block`
markers later added may span across an existing `catch`, resulting in
the incorrect code like:
```
try
  block     --|  (X)
catch         |
  end_block --|
end_try
```

Reviewers: dschuff

Subscribers: sunfish, sbc100, jgravelle-google, llvm-commits

Tags: #llvm

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

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

5 years ago[DWARFFormValue] Cleanup DWARFFormValue interface. (NFC)
Jonas Devlieghere [Wed, 27 Feb 2019 00:58:09 +0000 (00:58 +0000)]
[DWARFFormValue] Cleanup DWARFFormValue interface. (NFC)

DWARFFormValues can be created from a data extractor or by passing its
value directly. Until now this was done by member functions that
modified an existing object's internal state. This patch replaces a
subset of these methods with static method that return a new
DWARFFormValue.

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