OSDN Git Service

android-x86/external-llvm.git
5 years ago[NewPM] fixing asserts on deleted loop in -print-after-all
Fedor Sergeev [Tue, 11 Dec 2018 19:05:35 +0000 (19:05 +0000)]
[NewPM] fixing asserts on deleted loop in -print-after-all

IR-printing AfterPass instrumentation might be called on a loop
that has just been invalidated. We should skip printing it to
avoid spurious asserts.

Reviewed By: chandlerc, philip.pfaffe
Differential Revision: https://reviews.llvm.org/D54740

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

5 years ago[COFF, ARM64] Emit COFF function header
Mandeep Singh Grang [Tue, 11 Dec 2018 18:36:14 +0000 (18:36 +0000)]
[COFF, ARM64] Emit COFF function header

Summary:
Emit COFF header when printing out the function. This is important as the
header contains two important pieces of information: the storage class for the
symbol and the symbol type information. This bit of information is required for
the linker to correctly identify the type of symbol that it is dealing with.

This patch mimics X86 and ARM COFF behavior for function header emission.

Reviewers: rnk, mstorsjo, compnerd, TomTan, ssijaric

Reviewed By: mstorsjo

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

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

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

5 years ago[HotColdSplitting] Disable outlining landingpad instructions (PR39917)
Vedant Kumar [Tue, 11 Dec 2018 18:05:31 +0000 (18:05 +0000)]
[HotColdSplitting] Disable outlining landingpad instructions (PR39917)

It's currently not safe to outline landingpad instructions (see
llvm.org/PR39917). Like @llvm.eh.typeid.for, the order and content of
previous landingpad instructions in a function alters the lowering of
subsequent landingpads by renumbering type info ID's. Outlining a
landingpad therefore breaks exception handling & unwinding.

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

5 years ago[XRay] Add a helper function sortByKey to simplify code
Fangrui Song [Tue, 11 Dec 2018 17:34:15 +0000 (17:34 +0000)]
[XRay] Add a helper function sortByKey to simplify code

Reviewers: dberris, mboerger

Reviewed By: dberris

Subscribers: mgrang, llvm-commits

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

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

5 years ago[InstCombine] try to convert x86 movmsk intrinsic to generic IR (PR39927)
Sanjay Patel [Tue, 11 Dec 2018 16:38:03 +0000 (16:38 +0000)]
[InstCombine] try to convert x86 movmsk intrinsic to generic IR (PR39927)

call iM movmsk(sext <N x i1> X) --> zext (bitcast <N x i1> X to iN) to iM

This has the potential to create less-than-8-bit scalar types as shown in
some of the test diffs, but it looks like the backend knows how to deal
with that in these patterns. This is the simple part of the fix suggested in:
https://bugs.llvm.org/show_bug.cgi?id=39927

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

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

5 years ago[BDCE] Add tests for PR39771; NFC
Nikita Popov [Tue, 11 Dec 2018 16:37:26 +0000 (16:37 +0000)]
[BDCE] Add tests for PR39771; NFC

These involve cases where certain uses are dead by means of having
no demanded bits, even though the used instruction still has demanded
bits when other uses are taken into account. BDCE currently does not
simplify such cases.

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

5 years ago[llvm-readelf] Add -e/--headers support to readobj/elf
Sid Manning [Tue, 11 Dec 2018 16:15:03 +0000 (16:15 +0000)]
[llvm-readelf] Add -e/--headers support to readobj/elf

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

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

5 years agoFix not correct imm operand assertion for SUB32ri in X86CondBrFolding::analyzeCompare
Craig Topper [Tue, 11 Dec 2018 15:32:14 +0000 (15:32 +0000)]
Fix not correct imm operand assertion for SUB32ri in X86CondBrFolding::analyzeCompare

Summary:
When doing X86CondBrFolding::analyzeCompare, it will meet the SUB32ri instruction as below to use the global address for its operand,
  %733:gr32 = SUB32ri %62:gr32(tied-def 0), @img2buf_normal, implicit-def $eflags
  JNE_1 %bb.41, implicit $eflags

so the assertion "assert(MI.getOperand(ValueIndex).isImm() && "Expecting Imm operand")" is not correct and change the assert to if make X86CondBrFolding::analyzeCompare return false as not finding the compare for this

Patch by Jianping Chen

Reviewers: smaslov, LuoYuanke, liutianle, Jianping

Reviewed By: Jianping

Subscribers: lebedev.ri, llvm-commits

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

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

5 years ago[x86] clean up code for converting 16-bit ops to LEA; NFC
Sanjay Patel [Tue, 11 Dec 2018 15:29:40 +0000 (15:29 +0000)]
[x86] clean up code for converting 16-bit ops to LEA; NFC

As discussed in D55494, we want to extend this to handle 8-bit
ops too, but that could be extended further to enable this on
32-bit systems too.

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

5 years ago[x86] remove dead code for 16-bit LEA formation; NFC
Sanjay Patel [Tue, 11 Dec 2018 14:05:03 +0000 (14:05 +0000)]
[x86] remove dead code for 16-bit LEA formation; NFC

As discussed in:
D55494
...this code has been disabled/dead for a long time (the code references
Athlon and Pentium 4), and there's almost no chance that it will be used
given the last decade of uarch evolution. Also, in SDAG we promote 16-bit
ops to 32-bit, so there's almost no way to test this code any more.

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

5 years agoRevert r348843 "[CodeGen] Allow mempcy/memset to generate small overlapping stores."
Clement Courbet [Tue, 11 Dec 2018 13:38:43 +0000 (13:38 +0000)]
Revert r348843 "[CodeGen] Allow mempcy/memset to generate small overlapping stores."

Breaks ARM/memcpy-inline.ll

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

5 years ago[CodeGen] Allow mempcy/memset to generate small overlapping stores.
Clement Courbet [Tue, 11 Dec 2018 13:15:56 +0000 (13:15 +0000)]
[CodeGen] Allow mempcy/memset to generate small overlapping stores.

Summary:
All targets either just return false here or properly model `Fast`, so I
don't think there is any reason to prevent CodeGen from doing the right
thing here.

Subscribers: nemanjai, javed.absar, eraman, jsji, llvm-commits

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

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

5 years ago[TargetLowering] Add ISD::EXTRACT_VECTOR_ELT support to SimplifyDemandedBits
Simon Pilgrim [Tue, 11 Dec 2018 11:08:40 +0000 (11:08 +0000)]
[TargetLowering] Add ISD::EXTRACT_VECTOR_ELT support to SimplifyDemandedBits

Let SimplifyDemandedBits attempt to simplify all elements of a vector extraction.

Part of PR39689.

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

5 years agoFix "not all control paths return a value" MSVC warnings. NFCI.
Simon Pilgrim [Tue, 11 Dec 2018 10:44:54 +0000 (10:44 +0000)]
Fix "not all control paths return a value" MSVC warnings. NFCI.

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

5 years ago[DeadArgElim] Fixes for dbg.values using dead arg/return values
David Stenberg [Tue, 11 Dec 2018 10:33:38 +0000 (10:33 +0000)]
[DeadArgElim] Fixes for dbg.values using dead arg/return values

Summary:
When eliminating a dead argument or return value in a function with
local linkage, all uses, including in dbg.value intrinsics, would be
replaced with null constants. This would mean that, for example for an
integer argument, the debug info would incorrectly express that the
value is 0. Instead, replace all uses with undef to indicate that the
argument/return value is optimized out.

Also, make sure that metadata uses of return values are rewritten even
if there are no non-metadata uses of the value.

As a bit of historical curiosity, the code that emitted null constants
was introduced in the initial check-in of the pass in 2003, before
'undef' values even existed in LLVM.

This fixes PR23260.

Reviewers: dblaikie, aprantl, vsk, djtodoro

Reviewed By: aprantl

Subscribers: llvm-commits

Tags: #debug-info

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

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

5 years agoCleanup test case by removing unused attribute dso_local
Ranjeet Singh [Tue, 11 Dec 2018 09:32:49 +0000 (09:32 +0000)]
Cleanup test case by removing unused attribute dso_local

Attribute 'dso_local' generated in bitcode from compiling
original C file but isn't needed.

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

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

5 years ago[X86] Switch the 64-bit mulx schedule test to use inline assembly.
Craig Topper [Tue, 11 Dec 2018 07:41:06 +0000 (07:41 +0000)]
[X86] Switch the 64-bit mulx schedule test to use inline assembly.

I'm not sure we should always prefer MULX over MUL. So making the MULX guaranteed with inline assembly.

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

5 years ago[PPC][NFC] store operands are dst not src
Martell Malone [Tue, 11 Dec 2018 03:14:56 +0000 (03:14 +0000)]
[PPC][NFC] store operands are dst not src

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

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

5 years ago[gn build] Add build files for AsmParser, MIRParser, IRReader, MCDisassembler, Vectorize
Nico Weber [Tue, 11 Dec 2018 02:09:32 +0000 (02:09 +0000)]
[gn build] Add build files for AsmParser, MIRParser, IRReader, MCDisassembler, Vectorize

These are all remaining build dependencies of llc, except for Target/X86 which
is in a separate patch at https://reviews.llvm.org/D55524

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

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

5 years ago[WebAssembly] Add '.eventtype' directive support
Heejin Ahn [Tue, 11 Dec 2018 01:11:04 +0000 (01:11 +0000)]
[WebAssembly] Add '.eventtype' directive support

Summary:
This patch supports `.eventtype` directive printing and parsing in the
same syntax with `.functype`.

Reviewers: aardappel, sbc100

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

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

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

5 years ago[TextAPI][elfabi] Make SoName optional
Armando Montanez [Tue, 11 Dec 2018 01:00:16 +0000 (01:00 +0000)]
[TextAPI][elfabi] Make SoName optional

This change makes DT_SONAME treated as an optional trait for ELF TextAPI
stubs. This change accounts for the fact that shared objects aren't
guaranteed to have a DT_SONAME entry. Tests have been updated to check
for correct behavior of an optional soname.

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

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

5 years ago[WebAssembly] TargetStreamer cleanup (NFC)
Heejin Ahn [Tue, 11 Dec 2018 00:53:59 +0000 (00:53 +0000)]
[WebAssembly] TargetStreamer cleanup (NFC)

Summary:
- Unify mixed argument names (`Symbol` and `Sym`) to `Sym`
- Changed `MCSymbolWasm*` argument of `emit***` functions to `const
  MCSymbolWasm*`. It seems not very intuitive that emit function in the
  streamer modifies symbol contents.
- Moved empty function bodies to the header
- clang-format

Reviewers: aardappel, dschuff, sbc100

Subscribers: jgravelle-google, sunfish, llvm-commits

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

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

5 years ago[GISel]: Refactor MachineIRBuilder to allow passing additional parameters to build...
Aditya Nandakumar [Tue, 11 Dec 2018 00:48:50 +0000 (00:48 +0000)]
[GISel]: Refactor MachineIRBuilder to allow passing additional parameters to build Instrs

https://reviews.llvm.org/D55294

Previously MachineIRBuilder::buildInstr used to accept variadic
arguments for sources (which were either unsigned or
MachineInstrBuilder). While this worked well in common cases, it doesn't
allow us to build instructions that have multiple destinations.
Additionally passing in other optional parameters in the end (such as
flags) is not possible trivially. Also a trivial call such as

B.buildInstr(Opc, Reg1, Reg2, Reg3)
can be interpreted differently based on the opcode (2defs + 1 src for
unmerge vs 1 def + 2srcs).
This patch refactors the buildInstr to

buildInstr(Opc, ArrayRef<DstOps>, ArrayRef<SrcOps>)
where DstOps and SrcOps are typed unions that know how to add itself to
MachineInstrBuilder.
After this patch, most invocations would look like

B.buildInstr(Opc, {s32, DstReg}, {SrcRegs..., SrcMIBs..});
Now all the other calls (such as buildAdd, buildSub etc) forward to
buildInstr. It also makes it possible to build instructions with
multiple defs.
Additionally in a subsequent patch, we should make it possible to add
flags directly while building instructions.
Additionally, the main buildInstr method is now virtual and other
builders now only have to override buildInstr (for say constant
folding/cseing) is straightforward.

Also attached here (https://reviews.llvm.org/F7675680) is a clang-tidy
patch that should upgrade the API calls if necessary.

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

5 years agoFollow-up fix to r348811 for null Errors (which is the case for end iterators)
David Blaikie [Tue, 11 Dec 2018 00:17:36 +0000 (00:17 +0000)]
Follow-up fix to r348811 for null Errors (which is the case for end iterators)

Not sure how I missed that in my testing, but obvious enough - this
causes segfaults when attempting to dereference the Error in end
iterators.

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

5 years agollvm-objcopy: Improve/simplify llvm::Error handling during notes iteration
David Blaikie [Tue, 11 Dec 2018 00:09:06 +0000 (00:09 +0000)]
llvm-objcopy: Improve/simplify llvm::Error handling during notes iteration

Using an Error as an out parameter from an indirect operation like
iteration as described in the documentation (
http://llvm.org/docs/ProgrammersManual.html#building-fallible-iterators-and-iterator-ranges
) seems to be a little fussy - so here's /one/ possible solution, though
I'm not sure it's the right one.

Alternatively such APIs may be better off being switched to a standard
algorithm style, where they take a lambda to do the iteration work that
is then called back into (eg: "Error e = obj.for_each_note([](const
Note& N) { ... });"). This would be safer than having an unwritten
assumption that the user of such an iteration cannot return early from
the inside of the function - and must always exit through the gift
shop... I mean error checking. (even though it's guaranteed that if
you're mid-way through processing an iteration, it's not in an  error
state).

Alternatively we'd need some other (the super untrustworthy/thing we've
generally tried to avoid) error handling primitive that actually clears
the error state entirely so it's safe to ignore.

Fleshed this solution out a bit further during review - it now relies on
op==/op!= comparison as the equivalent to "if (Err)" testing the Error.
So just like an Error must be checked (even if it's in a success state),
the Error hiding in the iterator must be checked after each increment
(including by comparison with another iterator - perhaps this could be
constrained to only checking if the iterator is compared to the end
iterator? Not sure it's too important).

So now even just creating the iterator and not incrementing it at all
should still assert because the Error has not been checked.

Reviewers: lhames, jakehehrlich

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

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

5 years agodebuginfo: Use symbol difference for CU length to simplify assembly reading/editing
David Blaikie [Mon, 10 Dec 2018 22:44:48 +0000 (22:44 +0000)]
debuginfo: Use symbol difference for CU length to simplify assembly reading/editing

Mucking about simplifying a test case ( https://reviews.llvm.org/D55261 ) I stumbled across something I've hit before - that LLVM's (GCC's does too, FWIW) assembly output includes a hardcode length for a DWARF unit in its header. Instead we could emit a label difference - making the assembly easier to read/edit (though potentially at a slight (I haven't tried to observe it) performance cost of delaying/sinking the length computation into the MC layer).

Reviewers: JDevlieghere, probinson, ABataev

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

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

5 years ago[Local] Promote an utility that could be used elsewhere. NFCI.
Davide Italiano [Mon, 10 Dec 2018 22:17:04 +0000 (22:17 +0000)]
[Local] Promote an utility that could be used elsewhere. NFCI.

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

5 years agoFix LLVM_LINK_LLVM_DYLIB build of TapiTests
Sam Clegg [Mon, 10 Dec 2018 22:01:33 +0000 (22:01 +0000)]
Fix LLVM_LINK_LLVM_DYLIB build of TapiTests

A dependency on TestingSupport was introduced in rL348735 but
library was not incldued in the LLVM_LINK_LLVM_DYLIB build.

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

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

5 years ago[Hexagon] Couple of fixes in optimize addressing mode
Krzysztof Parzyszek [Mon, 10 Dec 2018 21:56:04 +0000 (21:56 +0000)]
[Hexagon] Couple of fixes in optimize addressing mode

- Check if an operand is an immediate before calling getImm. Some operands
  that take constant values can actually have global symbols or other
  constant expressions.
- When a load-constant instruction can be folded into users, make sure to
  only delete it when all users have been successfully converted.

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

5 years agoInstCombine: Scalarize single use icmp/fcmp
Matt Arsenault [Mon, 10 Dec 2018 21:50:54 +0000 (21:50 +0000)]
InstCombine: Scalarize single use icmp/fcmp

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

5 years ago[InstCombine] add tests for movmsk (PR39927) NFC
Sanjay Patel [Mon, 10 Dec 2018 21:44:20 +0000 (21:44 +0000)]
[InstCombine] add tests for movmsk (PR39927) NFC

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

5 years ago[Targets] Fixup incorrect targets in codemodel tests
David Green [Mon, 10 Dec 2018 20:55:34 +0000 (20:55 +0000)]
[Targets] Fixup incorrect targets in codemodel tests

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

5 years agoRevert "[Hexagon] Check if operand is an immediate before getImm"
Krzysztof Parzyszek [Mon, 10 Dec 2018 19:30:08 +0000 (19:30 +0000)]
Revert "[Hexagon] Check if operand is an immediate before getImm"

This reverts r348787. The patch wasn't quite correct.

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

5 years agoAPFloat: allow 64-bit of payload
JF Bastien [Mon, 10 Dec 2018 19:27:38 +0000 (19:27 +0000)]
APFloat: allow 64-bit of payload

Summary: The APFloat and Constant APIs taking an APInt allow arbitrary payloads,
and that's great. There's a convenience API which takes an unsigned, and that's
silly because it then directly creates a 64-bit APInt. Just change it to 64-bits
directly.

At the same time, add ConstantFP NaN getters which match the APFloat ones (with
getQNaN / getSNaN and APInt parameters).

Improve the APFloat testing to set more payload bits.

Reviewers: scanon, rjmccall

Subscribers: jkorous, dexonsmith, kristina, llvm-commits

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

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

5 years ago[GlobalISel] Restrict G_MERGE_VALUES capability and replace with new opcodes.
Amara Emerson [Mon, 10 Dec 2018 18:44:58 +0000 (18:44 +0000)]
[GlobalISel] Restrict G_MERGE_VALUES capability and replace with new opcodes.

This patch restricts the capability of G_MERGE_VALUES, and uses the new
G_BUILD_VECTOR and G_CONCAT_VECTORS opcodes instead in the appropriate places.

This patch also includes AArch64 support for selecting G_BUILD_VECTOR of <4 x s32>
and <2 x s64> vectors.

Differential Revisions: https://reviews.llvm.org/D53629

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

5 years ago[Hexagon] Check if operand is an immediate before getImm
Krzysztof Parzyszek [Mon, 10 Dec 2018 18:39:47 +0000 (18:39 +0000)]
[Hexagon] Check if operand is an immediate before getImm

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

5 years ago[Hexagon] Add patterns for any_extend from i1 and short vectors of i1
Krzysztof Parzyszek [Mon, 10 Dec 2018 18:36:06 +0000 (18:36 +0000)]
[Hexagon] Add patterns for any_extend from i1 and short vectors of i1

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

5 years ago[TargetLowering] Add UNDEF folding to SimplifyDemandedVectorElts
Simon Pilgrim [Mon, 10 Dec 2018 18:29:46 +0000 (18:29 +0000)]
[TargetLowering] Add UNDEF folding to SimplifyDemandedVectorElts

If all the demanded elements of the SimplifyDemandedVectorElts are known to be UNDEF, we can simplify to an ISD::UNDEF node.

Zero constant folding will be handled in a future patch - its a little trickier as we often have bitcasted zero values.

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

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

5 years ago[docs] Add the new Objective-C ARC intrinsics to the LangRef.
Erik Pilkington [Mon, 10 Dec 2018 18:19:43 +0000 (18:19 +0000)]
[docs] Add the new Objective-C ARC intrinsics to the LangRef.

These were added in r348441. This mostly just points to the clang documentation
to describe the intended semantics of each intrinsic.

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

5 years ago[DAGCombiner] Remove unnecessary recursive DAGCombiner::visitINSERT_SUBVECTOR call.
Simon Pilgrim [Mon, 10 Dec 2018 18:18:50 +0000 (18:18 +0000)]
[DAGCombiner] Remove unnecessary recursive DAGCombiner::visitINSERT_SUBVECTOR call.

As discussed on D55511, this caused an issue if the inner node deletes a node that the outer node depends upon. As it doesn't affect any lit-tests and I've only been able to expose this with the D55511 change I'm committing this now.

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

5 years ago[x86] fix formatting; NFC
Sanjay Patel [Mon, 10 Dec 2018 17:23:44 +0000 (17:23 +0000)]
[x86] fix formatting; NFC

This should really be generalized to allow increment and/or
we should replace it by using ISD::matchUnaryPredicate().
See D55515 for context.

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

5 years ago[AArch64] Refactor the Exynos scheduling predicates
Evandro Menezes [Mon, 10 Dec 2018 17:17:26 +0000 (17:17 +0000)]
[AArch64] Refactor the Exynos scheduling predicates

Refactor the scheduling predicates based on `MCInstPredicate`.  In this
case, for the Exynos processors.

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

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

5 years ago[AMDGPU] Change the l1 flush instruction for AMDPAL/MESA3D.
Neil Henning [Mon, 10 Dec 2018 16:35:53 +0000 (16:35 +0000)]
[AMDGPU] Change the l1 flush instruction for AMDPAL/MESA3D.

This commit changes which l1 flush instruction is used for AMDPAL and
MESA3d workloads to flush the entire l1 cache instead of just the
volatile lines.

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

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

5 years ago[x86] add tests for LowerVSETCC with min/max; NFC
Sanjay Patel [Mon, 10 Dec 2018 16:28:30 +0000 (16:28 +0000)]
[x86] add tests for LowerVSETCC with min/max; NFC

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

5 years ago[AArch64] Refactor the scheduling predicates
Evandro Menezes [Mon, 10 Dec 2018 16:24:30 +0000 (16:24 +0000)]
[AArch64] Refactor the scheduling predicates

Refactor the scheduling predicates based on `MCInstPredicate`.  Augment the
number of helper predicates used by processor specific predicates.

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

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

5 years ago[AMDGPU] Add new Mode Register pass - minor fix
Tim Corringham [Mon, 10 Dec 2018 16:23:30 +0000 (16:23 +0000)]
[AMDGPU] Add new Mode Register pass - minor fix

Trivial change to add parentheses to an expression to avoid a
sanitizer error in SIModeRegister.cpp, which was committed earlier.

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

5 years ago[llvm-mca] Add new tests for Exynos (NFC)
Evandro Menezes [Mon, 10 Dec 2018 16:22:29 +0000 (16:22 +0000)]
[llvm-mca] Add new tests for Exynos (NFC)

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

5 years ago[DAGCombiner] Simplify test case from r348759
Francis Visoiu Mistrih [Mon, 10 Dec 2018 16:04:56 +0000 (16:04 +0000)]
[DAGCombiner] Simplify test case from r348759

Thanks Simon for pointing that out.

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

5 years ago[AVX512] Update typo in comment
Cameron McInally [Mon, 10 Dec 2018 15:21:35 +0000 (15:21 +0000)]
[AVX512] Update typo in comment

Should be "Sae" for "Suppress All Exceptions".

NFC

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

5 years ago[GlobalISel] Set stack protector index when translating Intrinsic::stackprotector
Petr Pavlu [Mon, 10 Dec 2018 15:15:05 +0000 (15:15 +0000)]
[GlobalISel] Set stack protector index when translating Intrinsic::stackprotector

Record the stack protector index in MachineFrameInfo when translating
Intrinsic::stackprotector similarly as is done by SelectionDAG when
processing the same intrinsic.

Setting this index allows the Prologue/Epilogue Insertion to recognize
that the stack protection is enabled. The pass can then make sure that
the stack protector comes before local variables on the stack and
assigns potentially vulnerable objects first so they are close to the
stack protector slot.

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

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

5 years ago[mips][mc] Emit R_{MICRO}MIPS_JALR when expanding jal to jalr
Vladimir Stefanovic [Mon, 10 Dec 2018 15:07:36 +0000 (15:07 +0000)]
[mips][mc] Emit R_{MICRO}MIPS_JALR when expanding jal to jalr

When replacing jal with jalr, also emit '.reloc R_MIPS_JALR' (R_MICROMIPS_JALR
for micromips). The linker might then be able to turn jalr into a direct
call.
Add '-mips-jalr-reloc' to enable/disable this feature (default is true).

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

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

5 years ago[DAGCombiner] Use the result value type in visitCONCAT_VECTORS
Francis Visoiu Mistrih [Mon, 10 Dec 2018 14:31:34 +0000 (14:31 +0000)]
[DAGCombiner] Use the result value type in visitCONCAT_VECTORS

This triggers an assert when combining concat_vectors of a bitcast of
merge_values.

With asserts disabled, it fails to select:
fatal error: error in backend: Cannot select: 0x7ff19d000e90: i32 = any_extend 0x7ff19d000ae8
  0x7ff19d000ae8: f64,ch = CopyFromReg 0x7ff19d000c20:1, Register:f64 %1
    0x7ff19d000b50: f64 = Register %1
In function: d

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

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

5 years ago[NFC][AArch64] Remove duplicate Arch list in target parser tests
David Spickett [Mon, 10 Dec 2018 14:26:06 +0000 (14:26 +0000)]
[NFC][AArch64] Remove duplicate Arch list in target parser tests

The list generated in the target parser tests is the
same as the one in the AArch64 target parser.
Use that one instead.

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

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

5 years ago[AMDGPU] Add new Mode Register pass
Tim Corringham [Mon, 10 Dec 2018 12:06:10 +0000 (12:06 +0000)]
[AMDGPU] Add new Mode Register pass

A new pass to manage the Mode register.

Currently this just manages the floating point double precision
rounding requirements, but is intended to be easily extended to
encompass all Mode register settings.

The immediate motivation comes from the requirement to use the
round-to-zero rounding mode for the 16 bit interpolation
instructions, where the rounding mode setting is shared between
16 and 64 bit operations.

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

5 years ago[DebugInfo] Don't drop dbg.value's of nullptr
Jeremy Morse [Mon, 10 Dec 2018 12:04:08 +0000 (12:04 +0000)]
[DebugInfo] Don't drop dbg.value's of nullptr

Currently, dbg.value's of "nullptr" are dropped when entering a SelectionDAG --
apparently just because of an oversight when recognising Values that are
constant (see PR39787). This patch adds ConstantPointerNull to the list of
constants that can be turned into DBG_VALUEs.

The matter of what bit-value a null pointer constant in LLVM has was raised
in this mailing list thread:

  http://lists.llvm.org/pipermail/llvm-dev/2018-December/128234.html

Where it transpires LLVM relies on (IR) null pointers being zero valued,
thus I've baked this assumption into the patch.

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

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

5 years ago[DebugInfo] Emit undef DBG_VALUEs when SDNodes are optimised out
Jeremy Morse [Mon, 10 Dec 2018 11:20:47 +0000 (11:20 +0000)]
[DebugInfo] Emit undef DBG_VALUEs when SDNodes are optimised out

This is a fix for PR39896, where dbg.value's of SDNodes that have been
optimised out do not lead to "DBG_VALUE undef" instructions being created.
Such undef instructions are necessary to terminate earlier variable
ranges, otherwise variable values leak past the point where they're valid.

The "invalidated" flag of SDDbgValue is currently being abused to mean two
things:
 * The corresponding SDNode is now invalid
 * This SDDbgValue should not be emitted
Of which there are several legitimate combinations of meaning:
 * The SDNode has been invalidated and we should emit "DBG_VALUE undef"
 * The SDNode has been invalidated but the debug data was salvaged, don't
   emit anything for this SDDbgValue
 * This SDDbgValue has been emitted

This patch introduces distinct "Emitted" and "Invalidated" fields to the
SDDbgValue class, updates users accordingly, and generates "undef"
DBG_VALUEs for invalidated records. Awkwardly, there are circumstances
where we emit SDDbgValue's twice, specifically DebugInfo/X86/dbg-addr-dse.ll
which I've preserved.

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

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

5 years ago[X86] Fix AvoidStoreForwardingBlocks pass for negative displacements
Nikita Popov [Mon, 10 Dec 2018 10:16:50 +0000 (10:16 +0000)]
[X86] Fix AvoidStoreForwardingBlocks pass for negative displacements

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

The size of the first copy was computed as
std::abs(std::abs(LdDisp2) - std::abs(LdDisp1)), which results in
skipped bytes if the signs of LdDisp2 and LdDisp1 differ. As far as
I can see, this should just be LdDisp2 - LdDisp1. The case where
LdDisp1 > LdDisp2 is already handled in the code above, in which case
LdDisp2 is set to LdDisp1 and this subtraction will evaluate to
Size1 = 0, which is the correct value to skip an overlapping copy.

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

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

5 years ago[llvm-exegesis] Also check latency mode in local lit.
Clement Courbet [Mon, 10 Dec 2018 07:29:47 +0000 (07:29 +0000)]
[llvm-exegesis] Also check latency mode in local lit.

Summary: This should avoid failing on old CPUs that do not have a cycle counter.

Subscribers: tschuett, llvm-commits

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

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

5 years ago[CostModel][X86][AArch64] Adjust cost of the scalarization part of min/max reduction.
Craig Topper [Mon, 10 Dec 2018 06:58:58 +0000 (06:58 +0000)]
[CostModel][X86][AArch64] Adjust cost of the scalarization part of min/max reduction.

Summary: The comment says we need 3 extracts and a select at the end. But didn't we just account for the select in the vector cost above. Aren't we just extracting the single element after taking the min/max in the vector register?

Reviewers: RKSimon, spatel, ABataev

Reviewed By: RKSimon

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

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

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

5 years ago[X86] Merge addcarryx/addcarry intrinsic into a single addcarry intrinsic.
Craig Topper [Mon, 10 Dec 2018 06:07:50 +0000 (06:07 +0000)]
[X86] Merge addcarryx/addcarry intrinsic into a single addcarry intrinsic.

Both intrinsics do the exact same thing so we really only need one.

Earlier in the 8.0 cycle we changed the signature of this intrinsic without renaming it. But it looks difficult to get the autoupgrade code to allow me to merge the intrinsics and change the signature at the same time. So I've renamed the intrinsic slightly for the new merged intrinsic. I'm skipping autoupgrading from the previous new to 8.0 signature. I've also renamed the subborrow for consistency.

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

5 years ago[TextAPI][elfabi] Fix build by adding std::move() to r348735
Armando Montanez [Mon, 10 Dec 2018 03:05:58 +0000 (03:05 +0000)]
[TextAPI][elfabi] Fix build by adding std::move() to r348735

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

5 years ago[TextAPI][elfabi] Make TBE handlers functions that return Errors
Armando Montanez [Mon, 10 Dec 2018 02:36:33 +0000 (02:36 +0000)]
[TextAPI][elfabi] Make TBE handlers functions that return Errors

Since TBEHandler doesn't maintain state or otherwise have any need to be
a class right now, the read and write functions have been moved out and
turned into standalone functions. Additionally, the TBE read function
has been updated to return an Expected value for better error handling.
Tests have been updated to reflect these changes.

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

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

5 years ago[bugpoint] Find 'opt', etc., in bugpoint directory
Brian Gesiak [Mon, 10 Dec 2018 00:56:13 +0000 (00:56 +0000)]
[bugpoint] Find 'opt', etc., in bugpoint directory

Summary:
When bugpoint attempts to find the other executables it needs to run,
such as `opt` or `clang`, it tries searching the user's PATH. However,
in many cases, the 'bugpoint' executable is part of an LLVM build, and
the 'opt' executable it's looking for is in that same directory.

Many LLVM tools handle this case by using the `Paths` parameter of
`llvm::sys::findProgramByName`, passing the parent path of the currently
running executable. Do this same thing for bugpoint. However, to
preserve the current behavior exactly, first search the user's PATH,
and then search for 'opt' in the directory containing 'bugpoint'.

Test Plan:
`check-llvm`. Many of the existing bugpoint tests no longer need to use the
`--opt-command` option as a result of these changes.

Reviewers: MatzeB, silvas, davide

Reviewed By: MatzeB, davide

Subscribers: davide, llvm-commits

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

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

5 years agoRe-commit "[IR] Add NODISCARD to attribute functions"
Brian Gesiak [Sun, 9 Dec 2018 22:36:07 +0000 (22:36 +0000)]
Re-commit "[IR] Add NODISCARD to attribute functions"

Now that https://reviews.llvm.org/D55435 is committed,
https://reviews.llvm.org/D55217 can be committed once again -- all warnings are
now fixed.

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

5 years ago[AMDGPU] Fix discarded result of addAttribute
Brian Gesiak [Sun, 9 Dec 2018 21:56:50 +0000 (21:56 +0000)]
[AMDGPU] Fix discarded result of addAttribute

Summary:
`llvm::AttributeList` and `llvm::AttributeSet` are immutable, and so methods
defined on these classes, such as `addAttribute`, return a new immutable
object with the attribute added. In https://reviews.llvm.org/D55217 I attempted
to annotate methods such as `addAttribute` with `LLVM_NODISCARD`, since
calling these methods has no side-effects, and so ignoring the result
that is returned is almost certainly a programmer error.

However, committing the change resulted in new warnings in the AMDGPU target.
The AMDGPU simplify libcalls pass added in https://reviews.llvm.org/D36436
attempts to add the readonly and nounwind attributes to simplified
library functions, but instead calls the `addAttribute` methods and
ignores the result.

Modify the simplify libcalls pass to actually add the nounwind and
readonly attributes. Also update the simplify libcalls test to assert
that these attributes are actually being set.

Reviewers: rampitec, vpykhtin, rnk

Reviewed By: rampitec

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

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

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

5 years agoSpeculatively fixing the build; it seems add_pointer_t and add_const_t are not implem...
Aaron Ballman [Sun, 9 Dec 2018 20:04:54 +0000 (20:04 +0000)]
Speculatively fixing the build; it seems add_pointer_t and add_const_t are not implemented everywhere.

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

5 years agoAdding an STL-like type trait that is duplicated in multiple places in Clang.
Aaron Ballman [Sun, 9 Dec 2018 19:53:15 +0000 (19:53 +0000)]
Adding an STL-like type trait that is duplicated in multiple places in Clang.

This trait is used by several AST visitor classes to control whether the AST is visiting const nodes or non-const nodes. These uses cannot be easily replaced with the STL traits directly due to use of an unspecialized templated when a type is expected (due to the template template parameter involved).

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

5 years ago[X86] Add some comments about when some X86 intrinsic autoupgrade code was added.
Craig Topper [Sun, 9 Dec 2018 18:02:40 +0000 (18:02 +0000)]
[X86] Add some comments about when some X86 intrinsic autoupgrade code was added.

Someday we'd like to remove old autoupgrade code so it helps to annotate how long its been there so we don't have to go digging through commit history.

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

5 years ago[X86] If the carry input to an addcarry/subborrow intrinsic is known to be 0, emit...
Craig Topper [Sun, 9 Dec 2018 18:02:37 +0000 (18:02 +0000)]
[X86] If the carry input to an addcarry/subborrow intrinsic is known to be 0, emit a flag setting ADD/SUB instead of ADC/SBB.

Previously we had to take the carry in and add -1 to it to set the carry flag so we could use it with ADC/SBB. But if we know its 0 then we don't need to bother.

This should go a long way towards fixing PR24545.

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

5 years agoRemove unneeded dependency from lib/Target/X86/Utils/ to lib/IR (aka Core).
Nico Weber [Sun, 9 Dec 2018 15:15:13 +0000 (15:15 +0000)]
Remove unneeded dependency from lib/Target/X86/Utils/ to lib/IR (aka Core).

The dependency was added in r213995 in response to r213986 which did make
X86/Utils depend on IR, but r256680 later removed that dependency again.

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

5 years ago[x86] regenerate test checks; NFC
Sanjay Patel [Sun, 9 Dec 2018 14:47:53 +0000 (14:47 +0000)]
[x86] regenerate test checks; NFC

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

5 years ago[x86] don't try to convert add with undef operands to LEA
Sanjay Patel [Sun, 9 Dec 2018 14:40:37 +0000 (14:40 +0000)]
[x86] don't try to convert add with undef operands to LEA

The existing code tries to handle an undef operand while transforming an add to an LEA,
but it's incomplete because we will crash on the i16 test with the debug output shown below.
It's better to just give up instead. Really, GlobalIsel should have folded these before we
could get into trouble.

# Machine code for function add_undef_i16: NoPHIs, TracksLiveness, Legalized, RegBankSelected, Selected

bb.0 (%ir-block.0):
  liveins: $edi
  %1:gr32 = COPY killed $edi
  %0:gr16 = COPY %1.sub_16bit:gr32
  %5:gr64_nosp = IMPLICIT_DEF
  %5.sub_16bit:gr64_nosp = COPY %0:gr16
  %6:gr64_nosp = IMPLICIT_DEF
  %6.sub_16bit:gr64_nosp = COPY %2:gr16
  %4:gr32 = LEA64_32r killed %5:gr64_nosp, 1, killed %6:gr64_nosp, 0, $noreg
  %3:gr16 = COPY killed %4.sub_16bit:gr32
  $ax = COPY killed %3:gr16
  RET 0, implicit killed $ax

# End machine code for function add_undef_i16.

*** Bad machine code: Reading virtual register without a def ***
- function:    add_undef_i16
- basic block: %bb.0  (0x7fe6cd83d940)
- instruction: %6.sub_16bit:gr64_nosp = COPY %2:gr16
- operand 1:   %2:gr16
LLVM ERROR: Found 1 machine code errors.

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

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

5 years ago[X86] Extend pfm counter coverage for llvm-exegesis
Simon Pilgrim [Sun, 9 Dec 2018 13:45:15 +0000 (13:45 +0000)]
[X86] Extend pfm counter coverage for llvm-exegesis

Extension to rL348617, turns out llvm-exegesis doesn't need to match the perf counter name against a scheduler model resource name - so I've added a few more counters that I could find in the libpfm4 source code (and fix a typo in the knl/knm retired_uops counter - which uses 'all' instead of 'any').

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

5 years ago[X86] Add test for PR39926; NFC
Nikita Popov [Sun, 9 Dec 2018 12:02:56 +0000 (12:02 +0000)]
[X86] Add test for PR39926; NFC

The test file shows a case where the avoid store forwarding block
pass misses to copy a range (-1..1) when the load displacement
changes sign.

Baseline test for D55485.

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

5 years ago[COFF] Map truncated .eh_frame section name
Martin Storsjo [Sat, 8 Dec 2018 18:15:41 +0000 (18:15 +0000)]
[COFF] Map truncated .eh_frame section name

PE/COFF sections can have section names truncated to 8 chars, in order to
have the name available at runtime. (The string table, where long untruncated
names are stored, isn't loaded at runtime.)

This allows various llvm tools to dump the .eh_frame section from such
executables.

Patch by Peiyuan Song!

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

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

5 years ago[DAGCombiner] re-enable truncation of binops
Sanjay Patel [Sat, 8 Dec 2018 16:07:38 +0000 (16:07 +0000)]
[DAGCombiner] re-enable truncation of binops

This is effectively re-committing the changes from:
rL347917 (D54640)
rL348195 (D55126)
...which were effectively reverted here:
rL348604
...because the code had a bug that could induce infinite looping
or eventual out-of-memory compilation.

The bug was that this code did not guard against transforming
opaque constants. More details are in the post-commit mailing
list thread for r347917. A reduced test for that is included
in the x86 bool-math.ll file. (I wasn't able to reduce a PPC
backend test for this, but it was almost the same pattern.)

Original commit message for r347917:

The motivating case for this is shown in:
https://bugs.llvm.org/show_bug.cgi?id=32023
and the corresponding rot16.ll regression tests.

Because x86 scalar shift amounts are i8 values, we can end up with trunc-binop-trunc
sequences that don't get folded in IR.

As the TODO comments suggest, there will be regressions if we extend this (for x86,
we mostly seem to be missing LEA opportunities, but there are likely vector folds
missing too). I think those should be considered existing bugs because this is the
same transform that we do as an IR canonicalization in instcombine. We just need
more tests to make those visible independent of this patch.

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

5 years ago[x86] add 32-bit RUN for tests and test with opaque constants; NFC
Sanjay Patel [Sat, 8 Dec 2018 15:34:09 +0000 (15:34 +0000)]
[x86] add 32-bit RUN for tests and test with opaque constants; NFC

The opaque constant test is reduced from a Chrome file that
infinite-looped with rL347917.

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

5 years ago[gn build] Add build files for CodeGen subfolders AsmPrinter, GlobalISel, SelectionDAG.
Nico Weber [Sat, 8 Dec 2018 10:53:10 +0000 (10:53 +0000)]
[gn build] Add build files for CodeGen subfolders AsmPrinter, GlobalISel, SelectionDAG.

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

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

5 years ago[WebAssembly] Make WasmSymbol's signature usable for events (NFC)
Heejin Ahn [Sat, 8 Dec 2018 06:16:13 +0000 (06:16 +0000)]
[WebAssembly] Make WasmSymbol's signature usable for events (NFC)

Summary:
WasmSignature used to use its `WasmSignature` member variable only for
function types, but now it also can be used for events as well.

Reviewers: sbc100

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

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

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

5 years ago[llvm-readobj] Little clean up inside `parseDynamicTable`
Xing GUO [Sat, 8 Dec 2018 05:32:28 +0000 (05:32 +0000)]
[llvm-readobj] Little clean up inside `parseDynamicTable`

Summary:
This anoymous function actually has same logic with `Obj->toMappedAddr`.

Besides, I have a question on resolving illegal value. `gnu-readelf`, `gnu-objdump` and `llvm-objdump` could parse the test file 'test/tools/llvm-objdump/Inputs/private-headers-x86_64.elf', but `llvm-readobj` will fail when parse `DT_RELR` segment. Because, the value is 0x87654321 which is illegal. So, shall we do this clean up rather then remove the checking statements inside anoymous function?

```
if (Delta >= Phdr.p_filesz)
    return createError("Virtual address is not in any segment");
```

Reviewers: rupprecht, jhenderson

Reviewed By: jhenderson

Subscribers: llvm-commits

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

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

5 years ago[gn build] Merge r348593
Nico Weber [Sat, 8 Dec 2018 00:37:14 +0000 (00:37 +0000)]
[gn build] Merge r348593

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

5 years ago[SelectionDAG] Remove ISD::ADDC/ADDE from some undef handling code in getNode. NFCI
Craig Topper [Sat, 8 Dec 2018 00:27:34 +0000 (00:27 +0000)]
[SelectionDAG] Remove ISD::ADDC/ADDE from some undef handling code in getNode. NFCI

These nodes should have two results. A real VT and a Glue. But this code would have returned Undef which would only be a single result. But we're in the single result version of getNode so these opcodes should never be seen by this function anyway.

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

5 years ago[gn build] Add build files for lib/CodeGen, lib/Transforms/..., and lib/Bitcode/Writer
Nico Weber [Sat, 8 Dec 2018 00:09:56 +0000 (00:09 +0000)]
[gn build] Add build files for lib/CodeGen, lib/Transforms/..., and lib/Bitcode/Writer

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

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

5 years ago[X86] Remove the XFAILed test added in r348620
Craig Topper [Fri, 7 Dec 2018 22:16:40 +0000 (22:16 +0000)]
[X86] Remove the XFAILed test added in r348620

It seems to be unexpectedly passing on some bots probably because it requires asserts to fail, but doesn't say that. But we already have a patch in review to make it not xfail so I'd rather just focus on getting it passing rather than trying to figure out an unexpected pass.

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

5 years agoAMDGPU: Fix offsets for < 4-byte aggregate kernel arguments
Matt Arsenault [Fri, 7 Dec 2018 22:12:17 +0000 (22:12 +0000)]
AMDGPU: Fix offsets for < 4-byte aggregate kernel arguments

We were still using the rounded down offset and alignment even though
they aren't handled because you can't trivially bitcast the loaded
value.

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

5 years ago[GlobalISel] Add IR translation support for the @llvm.log10 intrinsic
Jessica Paquette [Fri, 7 Dec 2018 22:08:02 +0000 (22:08 +0000)]
[GlobalISel] Add IR translation support for the @llvm.log10 intrinsic

This adds IR translation support for @llvm.log10 and updates relevant tests.

https://reviews.llvm.org/D55392

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

5 years ago[Hexagon] Fix post-ra expansion of PS_wselect
Krzysztof Parzyszek [Fri, 7 Dec 2018 22:00:53 +0000 (22:00 +0000)]
[Hexagon] Fix post-ra expansion of PS_wselect

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

5 years ago[ModuleSummary] use StringRefs to avoid a redundant copy; NFC
George Burgess IV [Fri, 7 Dec 2018 21:47:32 +0000 (21:47 +0000)]
[ModuleSummary] use StringRefs to avoid a redundant copy; NFC

`Saver` is a StringSaver, which has a few overloads of `save` that all
ultimately just call `StringRef save(StringRef)`. Just take a StringRef
here instead of building up a std::string to convert it to a StringRef.

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

5 years agoFix unused variable warning. NFCI.
Simon Pilgrim [Fri, 7 Dec 2018 21:44:25 +0000 (21:44 +0000)]
Fix unused variable warning. NFCI.

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

5 years ago[WebAssembly] clang-format/clang-tidy AsmParser (NFC)
Heejin Ahn [Fri, 7 Dec 2018 21:35:37 +0000 (21:35 +0000)]
[WebAssembly] clang-format/clang-tidy AsmParser (NFC)

Summary:
- LLVM clang-format style doesn't allow one-line ifs.
- LLVM clang-tidy style says method names should start with a lowercase
  letter. But currently WebAssemblyAsmParser's parent class
  MCTargetAsmParser is mixing lowercase and uppercase method names
  itself so overridden methods cannot be renamed now.
- Changed else ifs after returns to ifs.
- Added some newlines for readability.

Reviewers: aardappel, sbc100

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

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

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

5 years agoDelete registerScope function
Heejin Ahn [Fri, 7 Dec 2018 21:31:14 +0000 (21:31 +0000)]
Delete registerScope function

`unregisterScope()` is not currently used, so removing it.

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

5 years agoFollow-up from r348441 to add the rest of the objc ARC intrinsics.
Pete Cooper [Fri, 7 Dec 2018 21:28:47 +0000 (21:28 +0000)]
Follow-up from r348441 to add the rest of the objc ARC intrinsics.

This adds the other intrinsics used by ARC and codegen's them to their respective runtime methods.

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

5 years ago[MemCpyOpt] memset->memcpy forwarding with undef tail
Nikita Popov [Fri, 7 Dec 2018 21:16:58 +0000 (21:16 +0000)]
[MemCpyOpt] memset->memcpy forwarding with undef tail

Currently memcpyopt optimizes cases like

    memset(a, byte, N);
    memcpy(b, a, M);

to

    memset(a, byte, N);
    memset(b, byte, M);

if M <= N. Often this allows further simplifications down the line,
which drop the first memset entirely.

This patch extends this optimization for the case where M > N, but we
know that the bytes a[N..M] are undef due to alloca/lifetime.start.

This situation arises relatively often for Rust code, because Rust does
not initialize trailing structure padding and loves to insert redundant
memcpys. This also fixes https://bugs.llvm.org/show_bug.cgi?id=39844.

For the implementation, I'm reusing a bit of code for a similar existing
optimization (direct memcpy of undef). I've also added memset support to
MemDepAnalysis GetLocation -- Instead, getPointerDependencyFrom could be
used, but it seems to make more sense to add this to GetLocation and thus
make the computation cachable.

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

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

5 years ago[MemCpyOpt] Add tests for memset->memcpy forwaring with undef tail; NFC
Nikita Popov [Fri, 7 Dec 2018 21:16:52 +0000 (21:16 +0000)]
[MemCpyOpt] Add tests for memset->memcpy forwaring with undef tail; NFC

These are baseline tests for D55120.

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

5 years agoAMDGPU: Use gfx9 instead of gfx8 in a test
Matt Arsenault [Fri, 7 Dec 2018 20:57:43 +0000 (20:57 +0000)]
AMDGPU: Use gfx9 instead of gfx8 in a test

They are the same for the purposes of the tests,
but it's much easier to write check lines for
the memory instructions with offsets.

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

5 years ago[HotColdSplitting] Refine definition of unlikelyExecuted
Vedant Kumar [Fri, 7 Dec 2018 20:24:04 +0000 (20:24 +0000)]
[HotColdSplitting] Refine definition of unlikelyExecuted

The splitting pass uses its 'unlikelyExecuted' predicate to statically
decide which blocks are cold.

- Do not treat noreturn calls as if they are cold unless they are actually
  marked cold. This is motivated by functions like exit() and longjmp(), which
  are not beneficial to outline.

- Do not treat inline asm as an outlining barrier. In practice asm("") is
  frequently used to inhibit basic block merging; enabling outlining in this case
  results in substantial memory savings.

- Treat invokes of cold functions as cold.

As a drive-by, remove the 'exceptionHandlingFunctions' predicate, because it's
no longer needed. The pass can identify & outline blocks dominated by EH pads,
so there's no need to special-case __cxa_begin_catch etc.

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

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

5 years ago[HotColdSplitting] Outline more than once per function
Vedant Kumar [Fri, 7 Dec 2018 20:23:52 +0000 (20:23 +0000)]
[HotColdSplitting] Outline more than once per function

Algorithm: Identify maximal cold regions and put them in a worklist. If
a candidate region overlaps with another, discard it. While the worklist
is full, remove a single-entry sub-region from the worklist and attempt
to outline it. By the non-overlap property, this should not invalidate
parts of the domtree pertaining to other outlining regions.

Testing: LNT results on X86 are clean. With test-suite + externals, llvm
outlines 134KB pre-patch, and 352KB post-patch (+ ~2.6x). The file
483.xalancbmk/src/Constants.cpp stands out as an extreme case where llvm
outlines over 100 times in some functions (mostly EH paths). There was
not a significant performance impact pre vs. post-patch.

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

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

5 years agoUpdate the Swift version numbers reported by objdump
Michael Trent [Fri, 7 Dec 2018 19:55:03 +0000 (19:55 +0000)]
Update the Swift version numbers reported by objdump

Summary:
Add Swift 4.1, Swift 4.2, and Swift 5 version numbers to objdump's
MachODump's print_imae_info routines.

rdar://46548425

Reviewers: pete, lhames, bob.wilson

Reviewed By: pete, bob.wilson

Subscribers: bob.wilson, llvm-commits

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

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

5 years ago[NativePDB] Reconstruct function declarations from debug info.
Zachary Turner [Fri, 7 Dec 2018 19:34:02 +0000 (19:34 +0000)]
[NativePDB] Reconstruct function declarations from debug info.

Previously we would create an lldb::Function object for each function
parsed, but we would not add these to the clang AST. This is a first
step towards getting local variable support working, as we first need an
AST decl so that when we create local variable entries, they have the
proper DeclContext.

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

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

5 years ago[llvm-tapi] Don't try to override SequenceTraits for std::string
Sam Clegg [Fri, 7 Dec 2018 19:29:00 +0000 (19:29 +0000)]
[llvm-tapi] Don't try to override SequenceTraits for std::string

For some reason this doesn't seem to work with LLVM_LINK_LLVM_DYLIB
build.

See https://logs.chromium.org/logs/chromium/bb/client.wasm.llvm/linux/37764/+/recipes/steps/LLVM_regression_tests/0/stdout

What is more it seems that overriding these traits for core types
(including std::string) is not supported/recommend by YAMLTraits.h.
See line 1918 which has the assertion:
 "only use LLVM_YAML_IS_SEQUENCE_VECTOR for types you control"

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

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