OSDN Git Service

android-x86/external-llvm.git
7 years agoTry to fix build.
Zachary Turner [Tue, 30 May 2017 22:00:37 +0000 (22:00 +0000)]
Try to fix build.

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

7 years ago[CodeView] Move CodeView YAML code to ObjectYAML.
Zachary Turner [Tue, 30 May 2017 21:53:05 +0000 (21:53 +0000)]
[CodeView] Move CodeView YAML code to ObjectYAML.

This is the beginning of an effort to move the codeview yaml
reader / writer into ObjectYAML so that it can be shared.
Currently the only consumer / producer of CodeView YAML is
llvm-pdbdump, but CodeView can exist outside of PDB files, and
indeed is put into object files and passed to the linker to
produce PDB files.  Furthermore, there are subtle differences
in the types of records that show up in object file CodeView
vs PDB file CodeView, but they are otherwise 99% the same.

By having this code in ObjectYAML, we can have llvm-pdbdump
reuse this code, while teaching obj2yaml and yaml2obj to use
this syntax for dealing with object files that can contain
CodeView.

This patch only adds support for CodeView type information
to ObjectYAML.  Subsequent patches will add support for
CodeView symbol information.

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

7 years agoTargetPassConfig: Keep a reference to an LLVMTargetMachine; NFC
Matthias Braun [Tue, 30 May 2017 21:36:41 +0000 (21:36 +0000)]
TargetPassConfig: Keep a reference to an LLVMTargetMachine; NFC

TargetPassConfig is not useful for targets that do not use the CodeGen
library, so we may just as well store a pointer to an
LLVMTargetMachine instead of just to a TargetMachine.

While at it, also change the constructor to take a reference instead of a
pointer as the TM must not be nullptr.

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

7 years agoMIR: remove explicit "noVRegs" property.
Tim Northover [Tue, 30 May 2017 21:28:57 +0000 (21:28 +0000)]
MIR: remove explicit "noVRegs" property.

We can infer this from the incoming MIR, so there's no reason to
represent it with a special flag.

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

7 years ago[PartialInlining] Shrinkwrap allocas with live range contained in outline region.
Xinliang David Li [Tue, 30 May 2017 21:22:18 +0000 (21:22 +0000)]
[PartialInlining] Shrinkwrap allocas with live range contained in outline region.

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

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

7 years ago[Localizer] Don't trick to be smart for the insertion point
Quentin Colombet [Tue, 30 May 2017 20:53:06 +0000 (20:53 +0000)]
[Localizer] Don't trick to be smart for the insertion point

There is no guarantee that the first use of a constant that is traversed
is actually the first in the related basic block. Thus, if we use that
as the insertion point we may end up with definitions that don't
dominate there use.

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

7 years ago[llvm-config] Fix cflags test looking for "warning"
Ben Langmuir [Tue, 30 May 2017 20:21:47 +0000 (20:21 +0000)]
[llvm-config] Fix cflags test looking for "warning"

This will fail if you configure with e.g. -Wno-unknown-warning-option.
Change it to check for 'warning:' just like we did for 'error:' in
r289484.

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

7 years ago[LV] Reapply r303763 with fix for PR33193
Matthew Simpson [Tue, 30 May 2017 19:55:57 +0000 (19:55 +0000)]
[LV] Reapply r303763 with fix for PR33193

r303763 caused build failures in some out-of-tree tests due to an assertion in
TTI. The original patch updated cost estimates for induction variable update
instructions marked for scalarization. However, it didn't consider that the
incoming value of an induction variable phi node could be a cast instruction.
This caused queries for cast instruction costs with a mix of vector and scalar
types. This patch includes a fix for cast instructions and the test case from
PR33193.

The fix was suggested by Jonas Paulsson <paulsson@linux.vnet.ibm.com>.

Reference: https://bugs.llvm.org/show_bug.cgi?id=33193
Original Differential Revision: https://reviews.llvm.org/D33457

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

7 years ago[Object] Remove unused field + constructor.
Benjamin Kramer [Tue, 30 May 2017 19:37:02 +0000 (19:37 +0000)]
[Object] Remove unused field + constructor.

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

7 years ago[Object] Fix pessimizing move.
Benjamin Kramer [Tue, 30 May 2017 19:36:58 +0000 (19:36 +0000)]
[Object] Fix pessimizing move.

Returning the Error by value triggers copy elision, the move is more
expensive. Clang rightfully warns about it.

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

7 years agoRevert "This patch closes PR28513: an optimization of multiplication by different...
Vedant Kumar [Tue, 30 May 2017 19:25:22 +0000 (19:25 +0000)]
Revert "This patch closes PR28513: an optimization of multiplication by different constants. It's implemented on DAG combiner level."

This reverts commit r304209.

I think this change is responsible for a tablgen failure in stage2 builds:

  http://green.lab.llvm.org/green/job/clang-stage2-configure-Rthinlto_build/2171/

I reproduced the failure locally (without ThinLTO), reverted the commit, rebuilt the stage1 clang, rebuilt the stage2 llvm-tblgen tool, and found that the crash disappears when the commit is reverted. Here is the stack trace:

FAILED: lib/Target/ARM/ARMGenRegisterBank.inc.tmp
cd /Volumes/Builds/pz-master-stage2-RA/lib/Target/ARM && /Volumes/Builds/pz-master-stage2-RA/bin/llvm-tblgen -gen-register-bank -I /Users/vk/llvm/lib/Target/ARM -I /Users/vk/llvm/include -I /Users/vk/llvm/lib/Target /Users/vk/llvm/lib/Target/ARM/ARM.td -o /Volumes
/Builds/pz-master-stage2-RA/lib/Target/ARM/ARMGenRegisterBank.inc.tmp
0  llvm-tblgen              0x0000000106fc9568 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  llvm-tblgen              0x0000000106fc9be6 SignalHandler(int) + 422
2  libsystem_platform.dylib 0x00000001076a7fba _sigtramp + 26
3  libsystem_platform.dylib 0x00007fff58deb468 _sigtramp + 1366570184
4  llvm-tblgen              0x0000000106e89cc7 llvm::CodeGenRegBank::getCompositeSubRegIndex(llvm::CodeGenSubRegIndex*, llvm::CodeGenSubRegIndex*) + 615
5  llvm-tblgen              0x0000000106e88be6 llvm::CodeGenRegister::computeSubRegs(llvm::CodeGenRegBank&) + 2182
6  llvm-tblgen              0x0000000106e8e9f0 llvm::CodeGenRegBank::CodeGenRegBank(llvm::RecordKeeper&) + 2192
7  llvm-tblgen              0x0000000106f384a1 llvm::EmitRegisterBank(llvm::RecordKeeper&, llvm::raw_ostream&) + 65
8  llvm-tblgen              0x0000000106f72c64 (anonymous namespace)::LLVMTableGenMain(llvm::raw_ostream&, llvm::RecordKeeper&) + 1172
9  llvm-tblgen              0x0000000106fcb15f llvm::TableGenMain(char*, bool (*)(llvm::raw_ostream&, llvm::RecordKeeper&)) + 3599
10 llvm-tblgen              0x0000000106f727a6 main + 134
11 libdyld.dylib            0x000000010733c6a5 start + 1
Stack dump:
0.      Program arguments: /Volumes/Builds/pz-master-stage2-RA/bin/llvm-tblgen -gen-register-bank -I /Users/vk/llvm/lib/Target/ARM -I /Users/vk/llvm/include -I /Users/vk/llvm/lib/Target /Users/vk/llvm/lib/Target/ARM/ARM.td -o /Volumes/Builds/pz-master-stage2-RA/lib/Target/ARM/ARMGenRegisterBank.inc.tmp
/bin/sh: line 1: 41986 Segmentation fault: 11  /Volumes/Builds/pz-master-stage2-RA/bin/llvm-tblgen -gen-register-bank -I /Users/vk/llvm/lib/Target/ARM -I /Users/vk/llvm/include -I /Users/vk/llvm/lib/Target /Users/vk/llvm/lib/Target/ARM/ARM.td -o /Volumes/Builds/pz
-master-stage2-RA/lib/Target/ARM/ARMGenRegisterBank.inc.tmp

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

7 years agoAdded missing break.
Galina Kistanova [Tue, 30 May 2017 19:02:49 +0000 (19:02 +0000)]
Added missing break.

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

7 years agoRevert "[Cloning] Take another pass at properly cloning debug info"
Keno Fischer [Tue, 30 May 2017 18:56:26 +0000 (18:56 +0000)]
Revert "[Cloning] Take another pass at properly cloning debug info"

At least one build bot is complaining. Will investigate after lunch.

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

7 years agoARM: Add missing flags to TBB_[JH]T pseudo instructions
Matthias Braun [Tue, 30 May 2017 18:52:33 +0000 (18:52 +0000)]
ARM: Add missing flags to TBB_[JH]T pseudo instructions

NFC except for calming down the machine verifier in some cases.

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

7 years ago[Cloning] Take another pass at properly cloning debug info
Keno Fischer [Tue, 30 May 2017 18:28:30 +0000 (18:28 +0000)]
[Cloning] Take another pass at properly cloning debug info

Summary:
In rL302576, DISubprograms gained the constraint that a !dbg attachments to functions must
have a 1:1 mapping to DISubprograms. As part of that change, the function cloning support
was adjusted to attempt to enforce this invariant during cloning. However, there
were several problems with the implementation. Part of these were fixed in rL304079.
However, there was a more fundamental problem with these changes, namely that it
bypasses the matadata value map, causing the cloned metadata to be a mix of metadata
pointing to the new suprogram (where manual code was added to fix those up) and the
old suprogram (where this was not the case). This mismatch could cause a number of
different assertion failures in the DWARF emitter. Some of these are given at
https://github.com/JuliaLang/julia/issues/22069, but some others have been observed
as well. Attempt to rectify this by partially reverting the manual DI metadata fixup,
and instead using the standard value map approach. To retain the desired semantics
of not duplicating the compilation unit and inlined subprograms, explicitly freeze
these in the value map.

Reviewers: dblaikie, aprantl, GorNishanov, echristo

Reviewed By: aprantl

Subscribers: llvm-commits

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

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

7 years agoAdding parsing ability for .res file.
Eric Beckmann [Tue, 30 May 2017 18:19:06 +0000 (18:19 +0000)]
Adding parsing ability for .res file.

Subscribers: llvm-commits

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

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

7 years ago[InstCombine] Add test cases to show missed opportunities to remove compare instructi...
Craig Topper [Tue, 30 May 2017 17:47:59 +0000 (17:47 +0000)]
[InstCombine] Add test cases to show missed opportunities to remove compare instructions after cttz/ctlz/ctpop where some bits of the input is known.

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

7 years ago[Hexagon] Improve code generation for 32x32-bit multiplication
Krzysztof Parzyszek [Tue, 30 May 2017 17:47:51 +0000 (17:47 +0000)]
[Hexagon] Improve code generation for 32x32-bit multiplication

For multiplications of 64-bit values (giving 64-bit result), detect
cases where the arguments are sign-extended 32-bit values, on a per-
operand basis. This will allow few patterns to match a wider variety
of combinations in which extensions can occur.

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

7 years ago[CodeView] Add more DebugSubsection implementations.
Zachary Turner [Tue, 30 May 2017 17:13:33 +0000 (17:13 +0000)]
[CodeView] Add more DebugSubsection implementations.

This adds implementations for Symbols and FrameData, and renames
the existing codeview::StringTable class to conform to the
DebugSectionStringTable convention.

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

7 years ago[SelectionDAG] Remove special case for ISD::FPOWI from the strict FP intrinsic handling.
Craig Topper [Tue, 30 May 2017 17:12:18 +0000 (17:12 +0000)]
[SelectionDAG] Remove special case for ISD::FPOWI from the strict FP intrinsic handling.

This code was compensating for FPOWI defaulting to Legal and many targets not changing it to Expand. This was fixed in r304215 to default to Expand so this special handling should no longer be necessary.

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

7 years ago[AMDGPU] Allow SDWA in instructions with immediates and SGPRs
Stanislav Mekhanoshin [Tue, 30 May 2017 16:49:24 +0000 (16:49 +0000)]
[AMDGPU] Allow SDWA in instructions with immediates and SGPRs

An encoding does not allow to use SDWA in an instruction with
scalar operands, either literals or SGPRs. That is however possible
to copy these operands into a VGPR first.

Several copies of the value are produced if multiple SDWA conversions
were done. To cleanup MachineLICM (to hoist copies out of loops),
MachineCSE (to remove duplicate copies) and SIFoldOperands (to replace
SGPR to VGPR copy with immediate copy right to the VGPR) runs are added
after the SDWA pass.

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

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

7 years ago[CodeView] Rename ModuleDebugFragment -> DebugSubsection.
Zachary Turner [Tue, 30 May 2017 16:36:15 +0000 (16:36 +0000)]
[CodeView] Rename ModuleDebugFragment -> DebugSubsection.

This is more concise, and matches the terminology used in other
parts of the codebase more closely.

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

7 years ago [AMDGPU] Require waitcnt before barrier for all targets; adjust tests.
Mark Searles [Tue, 30 May 2017 16:22:43 +0000 (16:22 +0000)]
[AMDGPU] Require waitcnt before barrier for all targets; adjust tests.

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

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

7 years ago[SelectionDAG] Set ISD::FPOWI to Expand by default
Craig Topper [Tue, 30 May 2017 15:27:55 +0000 (15:27 +0000)]
[SelectionDAG] Set ISD::FPOWI to Expand by default

Summary:
Currently FPOWI defaults to Legal and LegalizeDAG.cpp turns Legal into Expand for this opcode because Legal is a "lie".

This patch changes the default for this opcode to Expand and removes the hack from LegalizeDAG.cpp. It also removes all the code in the targets that set this opcode to Expand themselves since they can just rely on the default.

Reviewers: spatel, RKSimon, efriedma

Reviewed By: RKSimon

Subscribers: jfb, dschuff, sbc100, jgravelle-google, nemanjai, javed.absar, andrew.w.kaylor, llvm-commits

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

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

7 years agoThis patch closes PR28513: an optimization of multiplication by different constants.
Andrew V. Tischenko [Tue, 30 May 2017 13:00:44 +0000 (13:00 +0000)]
This patch closes PR28513: an optimization of multiplication by different constants.
It's implemented on DAG combiner level.

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

7 years ago[SCEV][NFC] Remove redundant params from isAvailableAtLoopEntry
Max Kazantsev [Tue, 30 May 2017 10:54:58 +0000 (10:54 +0000)]
[SCEV][NFC] Remove redundant params from isAvailableAtLoopEntry

Params DT and LI are redundant, because these values are contained in fields anyways.

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

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

7 years ago[SystemZ] Add decimal floating-point instructions
Ulrich Weigand [Tue, 30 May 2017 10:15:16 +0000 (10:15 +0000)]
[SystemZ] Add decimal floating-point instructions

This adds assembler / disassembler support for the decimal
floating-point instructions.  Since LLVM does not yet have
support for decimal float types, these cannot be used for
codegen at this point.

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

7 years ago[SystemZ] Add hexadecimal floating-point instructions
Ulrich Weigand [Tue, 30 May 2017 10:13:23 +0000 (10:13 +0000)]
[SystemZ] Add hexadecimal floating-point instructions

This adds assembler / disassembler support for the hexadecimal
floating-point instructions.  Since the Linux ABI does not use
any hex float data types, these are not useful for codegen.

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

7 years ago[SystemZ] Add missing assembler/disassembler tests
Ulrich Weigand [Tue, 30 May 2017 10:11:13 +0000 (10:11 +0000)]
[SystemZ] Add missing assembler/disassembler tests

A few instructions that are actually correctly supported in the
assembler and disassembler did not have any tests.

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

7 years ago[MC] Fix constant pools with DenseMap sentinel values
Oliver Stannard [Tue, 30 May 2017 09:37:11 +0000 (09:37 +0000)]
[MC] Fix constant pools with DenseMap sentinel values

The MC ConstantPool class uses a DenseMap to track generated constants, with
the int64_t value of the constant as the key. This fails when values of
0x7fffffffffffffff or 0x7ffffffffffffffe are inserted into the constant pool, as
these are sentinel values for DenseMap.

The fix is to use std::map instead, which doesn't use sentinel values.

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

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

7 years ago[mips] Expansion of LI.S and LI.D
Zoran Jovanovic [Tue, 30 May 2017 09:33:43 +0000 (09:33 +0000)]
[mips] Expansion of LI.S and LI.D
Author: smaksimovic
Reviewers: dsanders sdardis
Introduces LI.S and LI.D pseudo instructions with floating point operands.
Differential Revision: https://reviews.llvm.org/D14390

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

7 years agoFix PR33031: correct the estimate of maximum offset for instructions spilling/filling...
Kristof Beyls [Tue, 30 May 2017 06:58:41 +0000 (06:58 +0000)]
Fix PR33031: correct the estimate of maximum offset for instructions spilling/filling the stack.

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

7 years agoNewGVN: Compute hash value of expression on demand and use it in inequality testing.
Daniel Berlin [Tue, 30 May 2017 06:58:18 +0000 (06:58 +0000)]
NewGVN: Compute hash value of expression on demand and use it in inequality testing.

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

7 years agoNewGVN: Fix PR33194, memory corruption by putting temporary instructions in tables...
Daniel Berlin [Tue, 30 May 2017 06:42:29 +0000 (06:42 +0000)]
NewGVN: Fix PR33194, memory corruption by putting temporary instructions in tables sometimes.

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

7 years agoAdded LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
Galina Kistanova [Tue, 30 May 2017 03:30:34 +0000 (03:30 +0000)]
Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.

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

7 years agoAdded missing line continuation to HANDLE_DIEVALUE_SMALL and HANDLE_DIEVALUE_LARGE...
Galina Kistanova [Tue, 30 May 2017 03:21:12 +0000 (03:21 +0000)]
Added missing line continuation to HANDLE_DIEVALUE_SMALL and HANDLE_DIEVALUE_LARGE macros.

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

7 years agoReverted r303602, as it will be fixed in gtest.
Galina Kistanova [Tue, 30 May 2017 03:17:10 +0000 (03:17 +0000)]
Reverted r303602, as it will be fixed in gtest.

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

7 years agoRevert r303763, results in asserts i.e. while building Ruby.
Joerg Sonnenberger [Mon, 29 May 2017 22:52:17 +0000 (22:52 +0000)]
Revert r303763, results in asserts i.e. while building Ruby.

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

7 years ago[TableGen] Use StringMap instead of DenseMap<StringRef> to unique CodeInit and String...
Craig Topper [Mon, 29 May 2017 21:49:37 +0000 (21:49 +0000)]
[TableGen] Use StringMap instead of DenseMap<StringRef> to unique CodeInit and StringInit objects. Override the allocator to keep using the BumpPtrAllocator. NFCI

StringMap is better suited to mapping strings than a DenseMap.

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

7 years ago[TableGen] Introduce DagInit::getArgs that returns an ArrayRef. Use it to fix 80...
Craig Topper [Mon, 29 May 2017 21:49:34 +0000 (21:49 +0000)]
[TableGen] Introduce DagInit::getArgs that returns an ArrayRef. Use it to fix 80 column violations in arg_begin/arg_end. Remove DagInit::args and use getArgs instead. NFC

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

7 years ago[ManagedStatic] Avoid putting function pointers in template args.
Benjamin Kramer [Mon, 29 May 2017 20:56:27 +0000 (20:56 +0000)]
[ManagedStatic] Avoid putting function pointers in template args.

This is super awkward, but GCC doesn't let us have template visible when
an argument is an inline function and -fvisibility-inlines-hidden is
used.

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

7 years ago[GlobalIsel] Fix a warning with GCC 7 -Wpedantic. NFCI.
Davide Italiano [Mon, 29 May 2017 20:13:22 +0000 (20:13 +0000)]
[GlobalIsel] Fix a warning with GCC 7 -Wpedantic. NFCI.

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

7 years ago[X86] Add tests for (ix bitcast (vxi1 and ...)). NFC.
Zvi Rackover [Mon, 29 May 2017 19:00:57 +0000 (19:00 +0000)]
[X86] Add tests for (ix bitcast (vxi1 and ...)). NFC.

To be improved by D33311.

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

7 years ago[X86] Replace undef value in flaky test
Zvi Rackover [Mon, 29 May 2017 18:27:00 +0000 (18:27 +0000)]
[X86] Replace undef value in flaky test

D33311 exposes the flakiness in this test. Replacing the undef placed by
bugpoint, makes it more interesting and robust.

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

7 years ago[ManagedStatic] Make object_creator/object_deleter visible again.
Benjamin Kramer [Mon, 29 May 2017 18:00:33 +0000 (18:00 +0000)]
[ManagedStatic] Make object_creator/object_deleter visible again.

They're now exposed as template args, which creates complications when
ManagedStatics are used across .so boundaries.

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

7 years agoDon't destroy ManagedStatics in a unit test.
Benjamin Kramer [Mon, 29 May 2017 17:25:37 +0000 (17:25 +0000)]
Don't destroy ManagedStatics in a unit test.

Turns out this is very hostile towards other unit tests running in the
same process, it unregisters all flags.

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

7 years ago[wasm] Fix test after r304117.
Benjamin Kramer [Mon, 29 May 2017 16:32:52 +0000 (16:32 +0000)]
[wasm] Fix test after r304117.

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

7 years ago[X86] Don't fold away the memory operand of an xchg.
Benjamin Kramer [Mon, 29 May 2017 16:25:20 +0000 (16:25 +0000)]
[X86] Don't fold away the memory operand of an xchg.

xchg with a mem operand has different locking semantics. If we unfold it
into a xchg r,r we will loose the implicit lock. Likewise we never want
to fold a register xchg into a memory one as it would be a lot slower.

This triggers during LLVM selfhost.

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

7 years ago[Docs] Add VectorizationPlan to docs/Proposals.
Ayal Zaks [Mon, 29 May 2017 15:36:23 +0000 (15:36 +0000)]
[Docs] Add VectorizationPlan to docs/Proposals.

Following the request made in https://reviews.llvm.org/D32871, the
general documentation of the Vectorization Plan is hereby placed
under docs/Proposals.

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

7 years agoTry to work around MSVC being buggy. Attempt #1.
Benjamin Kramer [Mon, 29 May 2017 14:28:04 +0000 (14:28 +0000)]
Try to work around MSVC being buggy. Attempt #1.

error C2971: 'llvm::ManagedStatic': template parameter 'Creator': 'CreateDefaultTimerGroup': a variable with non-static storage duration cannot be used as a non-type argument

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

7 years ago[Timer] Move DefaultTimerGroup into a ManagedStatic.
Benjamin Kramer [Mon, 29 May 2017 14:05:29 +0000 (14:05 +0000)]
[Timer] Move DefaultTimerGroup into a ManagedStatic.

This used to be just leaked. r295370 made it use magic statics. This adds
a global destructor, which is something we'd like to avoid. It also creates
a weird situation where the mutex used by TimerGroup is re-created during
global shutdown and leaked.

Using a ManagedStatic here is also subtle as it relies on the mutex
inside of ManagedStatic to be recursive. I've added a test for that
in a previous change.

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

7 years ago[ManagedStatic] Add a way to pass custom creators/deleters.
Benjamin Kramer [Mon, 29 May 2017 14:05:26 +0000 (14:05 +0000)]
[ManagedStatic] Add a way to pass custom creators/deleters.

Also add a test case verifying that nested ManagedStatics work correctly.

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

7 years ago[DAGCombiner] fix load narrowing transform to exclude loads with extension
Sanjay Patel [Mon, 29 May 2017 13:24:58 +0000 (13:24 +0000)]
[DAGCombiner] fix load narrowing transform to exclude loads with extension

The extending load possibility was missed in:
https://reviews.llvm.org/rL304072

We might want to handle this cases as a follow-up, but bailing out for now
to avoid miscompiling.

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

7 years ago[SystemZ] Improve buildVector() in SystemZISelLowering.cpp.
Jonas Paulsson [Mon, 29 May 2017 13:22:23 +0000 (13:22 +0000)]
[SystemZ]  Improve buildVector() in SystemZISelLowering.cpp.

Use VLREP when inserting one or more loads into a vector. This is more
efficient than to first load and then use a VLVGP.

Review: Ulrich Weigand

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

7 years agoTest commit: fix typos
Mattias Eriksson [Mon, 29 May 2017 11:46:44 +0000 (11:46 +0000)]
Test commit: fix typos

Just fixing a few typos in comments to test commit access.

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

7 years ago[Nios2] Target registration
Nikolai Bozhenov [Mon, 29 May 2017 09:48:30 +0000 (09:48 +0000)]
[Nios2] Target registration

Reviewers: craig.topper, hfinkel, joerg, lattner, zvi

Reviewed By: craig.topper

Subscribers: oren_ben_simhon, igorb, belickim, tvvikram, mgorny, llvm-commits, pavel.v.chupin, DavidKreitzer

Differential Revision: https://reviews.llvm.org/D32669
Patch by AndreiGrischenko <andrei.l.grischenko@intel.com>

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

7 years ago[ARM] GlobalISel: Extract helper. NFCI.
Diana Picus [Mon, 29 May 2017 09:09:54 +0000 (09:09 +0000)]
[ARM] GlobalISel: Extract helper. NFCI.

Create a helper to deal with the common code for merging incoming values
together after they've been split during call lowering. There's likely
more stuff that can be commoned up here, but we'll leave that for later.

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

7 years ago[trivial] fix a typo in comment, NFC
Hiroshi Inoue [Mon, 29 May 2017 08:37:42 +0000 (08:37 +0000)]
[trivial] fix a typo in comment, NFC

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

7 years ago[ARM] GlobalISel: Support array returns
Diana Picus [Mon, 29 May 2017 08:19:19 +0000 (08:19 +0000)]
[ARM] GlobalISel: Support array returns

These are a bit rare in practice, but they don't require anything
special compared to array parameters, so support them as well.

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

7 years ago[PPC] Fix assertion failure during binary encoding with -mcpu=pwr9
Hiroshi Inoue [Mon, 29 May 2017 07:12:39 +0000 (07:12 +0000)]
[PPC] Fix assertion failure during binary encoding with -mcpu=pwr9

Summary
clang -c -mcpu=pwr9 test/CodeGen/PowerPC/build-vector-tests.ll causes an assertion failure during the binary encoding.
The failure occurs when a D-form load instruction takes two register operands instead of a register + an immediate.

This patch fixes the problem and also adds an assertion to catch this failure earlier before the binary encoding (i.e. during lit test).
The fix is from Nemanja Ivanovic @nemanjai.

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

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

7 years ago[ARM] GlobalISel: Support array parameters/arguments
Diana Picus [Mon, 29 May 2017 07:01:52 +0000 (07:01 +0000)]
[ARM] GlobalISel: Support array parameters/arguments

Clang coerces structs into arrays, so it's a good idea to support them.
Most of the support boils down to getting the splitToValueTypes helper
to actually split types. We then use G_INSERT/G_EXTRACT to deal with the
parts.

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

7 years agoDebugInfo: Include .dwo file name when hashing multiple CUs in a single file
Mehdi Amini [Mon, 29 May 2017 06:32:34 +0000 (06:32 +0000)]
DebugInfo: Include .dwo file name when hashing multiple CUs in a single file

This is really a workaround for ThinLTO in particular - since it can
import partial CUs that may end up looking very similar/the same as
the same partial import in another ThinLTO compile.

An alternative fix would be to change the DICompileUnit metadata to
include a "primary file" or the like - and when importing for ThinLTO
set the primary file to the name of the DICompileUnit that is being
imported into. This involves changing the schema and would reduce the
excessive uniqueness in the hash that this change creates - allowing
diagnosing of more duplicate CUs than will be caught with this change.

But duplicate CUs can still be caught in non-ThinLTO builds & are mostly
a nuisance rather than a particularly deliberate/effective tool for
finding broken code. (arguably the hash could always include the dwo
file and nothing in fission would break, I think..)

Reapply of r304119 after adding a triple to the test and moving it
to the X86 directory.

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

7 years agoDebugInfo: Omit an empty CU when a subprogram was moved into its use
Mehdi Amini [Mon, 29 May 2017 06:25:30 +0000 (06:25 +0000)]
DebugInfo: Omit an empty CU when a subprogram was moved into its use

When the only use of a CU is for a subprogram that's only emitted into
the using CU (to avoid cross-CU references in DWO files), avoid creating
that CU at all.

Reapply of r304111 after adding a triple to the test and moving it
to the X86 directory.

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

7 years agoRevert "[IfConversion] Keep the CFG updated incrementally in IfConvertTriangle"
Tobias Grosser [Mon, 29 May 2017 06:12:18 +0000 (06:12 +0000)]
Revert "[IfConversion] Keep the CFG updated incrementally in IfConvertTriangle"

The reverted change introdued assertions ala:

"MachineBasicBlock::succ_iterator
llvm::MachineBasicBlock::removeSuccessor(succ_iterator, bool): Assertion
`I != Successors.end() && "Not a current successor!"'

Mikael, the original committer, wrote me that he is working on a fix, but that
it likely will take some time to get this resolved. As this bug is one of the
last two issues that keep the AOSP buildbot from turning green, I revert the
original commit r302876.

I am looking forward to see this recommitted after the assertion has been
resolved.

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

7 years agoRevert "DebugInfo: Omit an empty CU when a subprogram was moved into its use"
Mehdi Amini [Mon, 29 May 2017 05:17:57 +0000 (05:17 +0000)]
Revert "DebugInfo: Omit an empty CU when a subprogram was moved into its use"

This reverts commit r304111.
GreenDragon is broken.

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

7 years agoRevert "DebugInfo: Include .dwo file name when hashing multiple CUs in a single file"
Mehdi Amini [Mon, 29 May 2017 05:17:54 +0000 (05:17 +0000)]
Revert "DebugInfo: Include .dwo file name when hashing multiple CUs in a single file"

This reverts commit r304119 and r304118. GreenDragon is broken.

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

7 years agoDon't capture a temporary std::string in a StringRef.
Zachary Turner [Mon, 29 May 2017 02:20:12 +0000 (02:20 +0000)]
Don't capture a temporary std::string in a StringRef.

This fixes the breakages in llvm-tblgen.

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

7 years agoResubmit "[X86] Adding new LLVM TableGen backend that generates the X86 backend memor...
Zachary Turner [Mon, 29 May 2017 02:19:37 +0000 (02:19 +0000)]
Resubmit "[X86] Adding new LLVM TableGen backend that generates the X86 backend memory folding tables."

This was reverted due to buildbot breakages and I was not familiar
with this code to investigate it.  But while trying to get a
useful backtrace for the author, it turns out the fix was very
obvious.  Resubmitting this patch as is, and will submit the
fix in a followup so that the fix is not hidden in the larger
CL.

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

7 years agoRevert "[X86] Adding new LLVM TableGen backend that generates the X86 backend memory...
Zachary Turner [Mon, 29 May 2017 01:48:53 +0000 (01:48 +0000)]
Revert "[X86] Adding new LLVM TableGen backend that generates the X86 backend memory folding tables."

This reverts commit 28cb1003507f287726f43c771024a1dc102c45fe as well
as all subsequent followups.  llvm-tblgen currently segfaults with
this change, and it seems it has been broken on the bots all
day with no fixes in preparation.  See, for example:

http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/

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

7 years agoDisabled implicit-fallthrough warnings for ConvertUTF.cpp.
Galina Kistanova [Mon, 29 May 2017 01:34:26 +0000 (01:34 +0000)]
Disabled implicit-fallthrough warnings for ConvertUTF.cpp.

ConvertUTF.cpp has a little dependency on LLVM, and since the code extensively uses fall-through switches,
I prefer disabling the warning for the whole file, rather than adding attributes for each case.

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

7 years agoDebugInfo: Include .dwo file name when hashing multiple CUs in a single file
David Blaikie [Mon, 29 May 2017 00:48:45 +0000 (00:48 +0000)]
DebugInfo: Include .dwo file name when hashing multiple CUs in a single file

This is really a workaround for ThinLTO in particular - since it can
import partial CUs that may end up looking very similar/the same as
the same partial import in another ThinLTO compile.

An alternative fix would be to change the DICompileUnit metadata to
include a "primary file" or the like - and when importing for ThinLTO
set the primary file to the name of the DICompileUnit that is being
imported into. This involves changing the schema and would reduce the
excessive uniqueness in the hash that this change creates - allowing
diagnosing of more duplicate CUs than will be caught with this change.

But duplicate CUs can still be caught in non-ThinLTO builds & are mostly
a nuisance rather than a particularly deliberate/effective tool for
finding broken code. (arguably the hash could always include the dwo
file and nothing in fission would break, I think..)

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

7 years agoAttempt to fix buildbots...
David Blaikie [Mon, 29 May 2017 00:24:01 +0000 (00:24 +0000)]
Attempt to fix buildbots...

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

7 years agoSupport: adjust the default obj format for wasm
Saleem Abdulrasool [Mon, 29 May 2017 00:14:57 +0000 (00:14 +0000)]
Support: adjust the default obj format for wasm

WebAssemly uses a custom object file format.  For the wasm targets,
default to the `Wasm` object file format.

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

7 years ago[AVR] Remove SREG from CPI's Uses; authored by Florian Zeitz
Dylan McKay [Mon, 29 May 2017 00:10:14 +0000 (00:10 +0000)]
[AVR] Remove SREG from CPI's Uses; authored by Florian Zeitz

Summary: CPI does not read the status register, but only writes it.

Reviewers: dylanmckay

Reviewed By: dylanmckay

Subscribers: llvm-commits

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

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

7 years ago[TableGen][X86] Fix formatting I accidentally messed up in r304099. NFC
Craig Topper [Sun, 28 May 2017 23:47:17 +0000 (23:47 +0000)]
[TableGen][X86] Fix formatting I accidentally messed up in r304099. NFC

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

7 years ago[ItaniumDemangle] Fix a exponential string copying bug
Erik Pilkington [Sun, 28 May 2017 23:24:52 +0000 (23:24 +0000)]
[ItaniumDemangle] Fix a exponential string copying bug

This is a port of libcxxabi's r304113.

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

7 years agoPrune trailing whitespace. (To regenerate makefiles)
NAKAMURA Takumi [Sun, 28 May 2017 22:54:25 +0000 (22:54 +0000)]
Prune trailing whitespace. (To regenerate makefiles)

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

7 years agoDebugInfo: Omit an empty CU when a subprogram was moved into its use
David Blaikie [Sun, 28 May 2017 22:51:37 +0000 (22:51 +0000)]
DebugInfo: Omit an empty CU when a subprogram was moved into its use

When the only use of a CU is for a subprogram that's only emitted into
the using CU (to avoid cross-CU references in DWO files), avoid creating
that CU at all.

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

7 years ago[AArch64][Falkor] Combine sched details files into one. NFC.
Geoff Berry [Sun, 28 May 2017 22:20:44 +0000 (22:20 +0000)]
[AArch64][Falkor] Combine sched details files into one. NFC.

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

7 years ago[AArch64][Falkor] Fix some sched details.
Geoff Berry [Sun, 28 May 2017 21:48:31 +0000 (21:48 +0000)]
[AArch64][Falkor] Fix some sched details.

- Remove all uses of base sched model entries and set them all to
  Unsupported so all the opcodes are described in
  AArch64SchedFalkorDetails.td.
- Remove entries for unsupported half-float opcodes.
- Remove entries for unsupported LSE extension opcodes.
- Add entry for MOVbaseTLS (and set Sched in base td file entry to
  WriteSys) and a few other pseudo ops.
- Fix a few FP load/store with reg offset entries to use the LSLfast
  predicates.
- Add Q size BIF/BIT/BSL entries.
- Fix swapped Q/D sized CLS/CLZ/CNT/RBIT entires.
- Fix pre/post increment address register latency (this operand is
  always dest 0).
- Fix swapped FCVTHD/FCVTHS/FCVTDH/FCVTDS entries.
- Fix XYZ resource over usage on LD[1-4] opcodes.

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

7 years ago[TableGen][X86] Use CHAR_BIT with sizeof instead of hardcoded 8. NFC
Craig Topper [Sun, 28 May 2017 18:24:43 +0000 (18:24 +0000)]
[TableGen][X86] Use CHAR_BIT with sizeof instead of hardcoded 8. NFC

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

7 years ago[TableGen][X86] Mark a couple global tables as const. NFC
Craig Topper [Sun, 28 May 2017 18:24:41 +0000 (18:24 +0000)]
[TableGen][X86] Mark a couple global tables as const. NFC

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

7 years ago[TableGen][X86] Improve formatting of the fold table output by indenting the body...
Craig Topper [Sun, 28 May 2017 18:24:39 +0000 (18:24 +0000)]
[TableGen][X86] Improve formatting of the fold table output by indenting the body of the table and adding blank lines between tables. NFC

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

7 years ago[TableGen][X86] Add an llvm_unreachable to a switch so we get an error if we need...
Craig Topper [Sun, 28 May 2017 18:24:37 +0000 (18:24 +0000)]
[TableGen][X86] Add an llvm_unreachable to a switch so we get an error if we need expansion in the future.

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

7 years ago[TableGen][X86] Remove unnecessary std::string creations. NFC
Craig Topper [Sun, 28 May 2017 18:24:35 +0000 (18:24 +0000)]
[TableGen][X86] Remove unnecessary std::string creations. NFC

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

7 years ago[TableGen][X86] Replace a global std::vector with a regular array. llvm::find works...
Craig Topper [Sun, 28 May 2017 18:24:32 +0000 (18:24 +0000)]
[TableGen][X86] Replace a global std::vector with a regular array. llvm::find works on arrays, just need to use std::end to check the result.

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

7 years ago[TableGen][X86] getValueAsString returns a std::string not a StringRef. Capture it...
Craig Topper [Sun, 28 May 2017 17:48:41 +0000 (17:48 +0000)]
[TableGen][X86] getValueAsString returns a std::string not a StringRef. Capture it that way to avoid a StringRef to a temporary.

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

7 years ago[x86] auto-generate better checks; NFC
Sanjay Patel [Sun, 28 May 2017 13:57:59 +0000 (13:57 +0000)]
[x86] auto-generate better checks; NFC

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

7 years ago[InstrProf] Use more ArrayRef/StringRef.
Benjamin Kramer [Sun, 28 May 2017 13:23:02 +0000 (13:23 +0000)]
[InstrProf] Use more ArrayRef/StringRef.

No functional change intended.

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

7 years ago[X86] Adding new LLVM TableGen backend that generates the X86 backend memory folding...
Ayman Musa [Sun, 28 May 2017 12:55:36 +0000 (12:55 +0000)]
[X86] Adding new LLVM TableGen backend that generates the X86 backend memory folding tables.

X86 backend holds huge tables in order to map between the register and memory forms of each instruction.
This TableGen Backend automatically generated all these tables with the appropriate flags for each entry.

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

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

7 years ago[X86] Adding FoldGenRegForm helper field (for memory folding tables tableGen backend...
Ayman Musa [Sun, 28 May 2017 12:39:37 +0000 (12:39 +0000)]
[X86] Adding FoldGenRegForm helper field (for memory folding tables tableGen backend) to X86Inst class and set its value for the relevant instructions.

Some register-register instructions can be encoded in 2 different ways, this happens when 2 register operands can be folded (separately).
For example if we look at the MOV8rr and MOV8rr_REV, both instructions perform exactly the same operation, but are encoded differently. Here is the relevant information about these instructions from Intel's 64-ia-32-architectures-software-developer-manual:

Opcode  Instruction  Op/En  64-Bit Mode  Compat/Leg Mode  Description
8A /r   MOV r8,r/m8  RM     Valid        Valid            Move r/m8 to r8.
88 /r   MOV r/m8,r8  MR     Valid        Valid            Move r8 to r/m8.
Here we can see that in order to enable the folding of the output and input registers, we had to define 2 "encodings", and as a result we got 2 move 8-bit register-register instructions.

In the X86 backend, we define both of these instructions, usually one has a regular name (MOV8rr) while the other has "_REV" suffix (MOV8rr_REV), must be marked with isCodeGenOnly flag and is not emitted from CodeGen.

Automatically generating the memory folding tables relies on matching encodings of instructions, but in these cases where we want to map both memory forms of the mov 8-bit (MOV8rm & MOV8mr) to MOV8rr (not to MOV8rr_REV) we have to somehow point from the MOV8rr_REV to the "regular" appropriate instruction which in this case is MOV8rr.

This field enable this "pointing" mechanism - which is used in the TableGen backend for generating memory folding tables.

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

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

7 years ago[X86] Fixing VPOPCNTDQ feature set lookup.
Oren Ben Simhon [Sun, 28 May 2017 11:26:11 +0000 (11:26 +0000)]
[X86] Fixing VPOPCNTDQ feature set lookup.

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

7 years agoReverted r304083 as it seems there is a desire to address this in the googletest.
Galina Kistanova [Sun, 28 May 2017 05:50:22 +0000 (05:50 +0000)]
Reverted r304083 as it seems there is a desire to address this in the googletest.

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

7 years agoAdded braces to address gcc warning: suggest explicit braces to avoid ambiguous ...
Galina Kistanova [Sun, 28 May 2017 03:50:52 +0000 (03:50 +0000)]
Added braces to address gcc warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]. NFC.

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

7 years agoDebugInfo: Add source code/build instructions for split-dwarf-dwp symbolizer test
David Blaikie [Sat, 27 May 2017 19:52:20 +0000 (19:52 +0000)]
DebugInfo: Add source code/build instructions for split-dwarf-dwp symbolizer test

Addressing post-commit code review feedback from Paul Robinson on
r303609.

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

7 years agoCloning: Fix debug info cloning
Gor Nishanov [Sat, 27 May 2017 19:41:09 +0000 (19:41 +0000)]
Cloning: Fix debug info cloning

Summary:
I believe https://reviews.llvm.org/rL302576 introduced two bugs:

1) it produces duplicate distinct variables for every: dbg.value describing the same variable.
    To fix the problme I switched form getDistinct() to get() in DebugLoc.cpp: auto reparentVar = [&](DILocalVariable *Var) {
    return DILocalVariable::getDistinct(

2) It passes NewFunction plain name as a linkagename parameter to Subprogram constructor. Breaks assert in:

 || DeclLinkageName.empty()) || LinkageName == DeclLinkageName) && "decl has a linkage name and it is different"' failed.
#9 0x00007f5010261b75 llvm::DwarfUnit::applySubprogramDefinitionAttributes(llvm::DISubprogram const*, llvm::DIE&) /home/gor/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp:1173:3
#
(Edit: reproducer added)

Here how https://reviews.llvm.org/rL302576 broke coroutine debug info.
Coroutine body of the original function is split into several parts by cloning and removing unneeded code.
All parts describe the original function and variables present in the original function.

For a simple case, prior to Split, original function has these two blocks:

```
PostSpill:                                        ; preds = %AllocaSpillBB
  call void @llvm.dbg.value(metadata i32 %x, i64 0, metadata !14, metadata !15), !dbg !13
  store i32 %x, i32* %x.addr, align 4
  ...
and

sw.epilog:                                        ; preds = %sw.bb
  %x.addr.reload.addr = getelementptr inbounds %f.Frame, %f.Frame* %FramePtr, i32 0, i32 4, !dbg !20
  %4 = load i32, i32* %x.addr.reload.addr, align 4, !dbg !20
  call void @llvm.dbg.value(metadata i32 %4, i64 0, metadata !14, metadata !15), !dbg !13

!14 = !DILocalVariable(name: "x", arg: 1, scope: !6, file: !7, line: 55, type: !11)

```

Note that in two blocks different expression represent the same original user variable X.

Before rL302576, for every cloned function there was exactly one cloned DILocalVariable(name: "x" as in:

```
define i8* @f(i32 %x) #0 !dbg !6 {
  ...
!6 = distinct !DISubprogram(name: "f", scope: !7, file: !7, line: 55, type: !8, isLocal: false, isDefinition: true, scopeLine: 55, flags: DIFlagPrototyped,
...
!14 = !DILocalVariable(name: "x", arg: 1, scope: !6, file: !7, line: 55, type: !11)

define internal fastcc void @f.resume(%f.Frame* %FramePtr) #0 !dbg !25 {
...
!25 = distinct !DISubprogram(name: "f", scope: !7, file: !7, line: 55, type: !8, isLocal: false, isDefinition: true, scopeLine: 55, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
!28 = !DILocalVariable(name: "x", arg: 1, scope: !25, file: !7, line: 55, type: !11)
```
After rL302576, for every cloned function there were as many DILocalVariable(name: "x" as there were "call void @llvm.dbg.value" for that variable.
This was causing asserts in VerifyDebugInfo and AssemblyPrinter.

Example:

```
!27 = distinct !DISubprogram(name: "f", linkageName: "f.resume", scope: !7, file: !7, line: 55, type: !8, isLocal: false, isDefinition: true, scopeLine: 55,
!29 = distinct !DILocalVariable(name: "x", arg: 1, scope: !27, file: !7, line: 55, type: !11)
!39 = distinct !DILocalVariable(name: "x", arg: 1, scope: !27, file: !7, line: 55, type: !11)
!41 = distinct !DILocalVariable(name: "x", arg: 1, scope: !27, file: !7, line: 55, type: !11)
```

Second problem:

Prior to rL302576, all clones were described by DISubprogram referring to original function.

```
define i8* @f(i32 %x) #0 !dbg !6 {
...
!6 = distinct !DISubprogram(name: "f", scope: !7, file: !7, line: 55, type: !8, isLocal: false, isDefinition: true, scopeLine: 55, flags: DIFlagPrototyped,

define internal fastcc void @f.resume(%f.Frame* %FramePtr) #0 !dbg !25 {
...
!25 = distinct !DISubprogram(name: "f", scope: !7, file: !7, line: 55, type: !8, isLocal: false, isDefinition: true, scopeLine: 55, flags: DIFlagPrototyped,
```

After rL302576, DISubprogram for clones is of two minds, plain name refers to the original name, linkageName refers to plain name of the clone.

```
!27 = distinct !DISubprogram(name: "f", linkageName: "f.resume", scope: !7, file: !7, line: 55, type: !8, isLocal: false, isDefinition: true, scopeLine: 55,
```

I think the assumption in AsmPrinter is that both name and linkageName should refer to the same entity. It asserts here when they are not:

```
 || DeclLinkageName.empty()) || LinkageName == DeclLinkageName) && "decl has a linkage name and it is different"' failed.
#9 0x00007f5010261b75 llvm::DwarfUnit::applySubprogramDefinitionAttributes(llvm::DISubprogram const*, llvm::DIE&) /home/gor/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp:1173:3
```
After this fix, behavior (with respect to coroutines) reverts to exactly as it was before and therefore making them debuggable again, or even more importantly, compilable, with "-g"

Reviewers: dblaikie, echristo, aprantl

Reviewed By: dblaikie

Subscribers: llvm-commits

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

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

7 years agoRecommit "[DWARF] - Make collectAddressRanges() return section index in addition...
George Rimar [Sat, 27 May 2017 18:10:23 +0000 (18:10 +0000)]
Recommit "[DWARF] - Make collectAddressRanges() return section index in addition to Low/High PC"

With fix of uninitialized variable.

Original commit message:

This change is intended to use for LLD in D33183.
Problem we have in LLD when building .gdb_index is that we need to know section which address range belongs to.

Previously it was solved on LLD side by providing fake section addresses with use of llvm::LoadedObjectInfo
interface. We assigned file offsets as addressed. Then after obtaining ranges lists, for each range we had to find section ID's.
That not only was slow, but also complicated implementation and was the reason of incorrect behavior when
sections share the same offsets, like D33176 shows.

This patch makes DWARF parsers to return section index as well. That solves problem mentioned above.

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

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

7 years ago[TableGen] Prevent DagInit from leaking its Args and ArgNames when they exceed the...
Craig Topper [Sat, 27 May 2017 17:36:50 +0000 (17:36 +0000)]
[TableGen] Prevent DagInit from leaking its Args and ArgNames when they exceed the size of the SmallVector.

DagInits are allocated in a BumpPtrAllocator so they are never destructed. This means the destructor for the SmallVector never runs.

To fix this we now allocate the vectors in the BumpPtrAllocator too using TrailingObjects.

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

7 years ago[TableGen] Use the correct type for the first template for the ListInit TrailingObjects.
Craig Topper [Sat, 27 May 2017 17:36:47 +0000 (17:36 +0000)]
[TableGen] Use the correct type for the first template for the ListInit TrailingObjects.

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

7 years ago[SCEV] Assume parameters coming from function calls contain IVs
Tobias Grosser [Sat, 27 May 2017 15:17:49 +0000 (15:17 +0000)]
[SCEV] Assume parameters coming from function calls contain IVs

The optimistic delinearization implemented in LLVM detects array sizes by
looking for non-linear products between parameters and induction variables.
In OpenCL code, such products often look like:

  A[get_global_id(0) * N + get_global_id(1)]

Hence, the IV is hidden in the get_global_id() call and consequently
delinearization would fail as no induction variable is available that helps
us to identify N as array size parameter.

We now use a very simple heuristic to change this. We assume that each parameter
that comes directly from a function call is a hidden induction variable. As
a result, we can delinearize the access above to:

  A[get_global_id(0)][get_global_id(1]

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