153674 Commits

Author SHA1 Message Date
Yuka Takahashi
f9f2c95eca Revert "Revert r311552: [Bash-autocompletion] Add support for static analyzer flags"
This reverts commit 7c46b80c022e18d43c1fdafb117b0c409c5a6d1e.

r311552 broke lld buildbot because I've changed OptionInfos type from
ArrayRef to vector. However the bug is fixed, so I'll commit this again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311958 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-29 00:09:31 +00:00
Bob Haarman
2eaf4212bb [codeview] support more DW_OPs for more complete debug info
Summary:
Some variables show up in Visual Studio as "optimized out" even in -O0
-Od builds. This change fixes two issues that would cause this to
happen. The first issue is that not all DIExpressions we generate were
recognized by the CodeView writer. This has been addressed by adding
support for DW_OP_constu, DW_OP_minus, and DW_OP_plus. The second
issue is that we had no way to encode DW_OP_deref in CodeView. We get
around that by changinge the type we encode in the debug info to be
a reference to the type in the source code.

This fixes PR34261.

Reviewers: aprantl, rnk, zturner

Reviewed By: rnk

Subscribers: mgorny, llvm-commits, aprantl, hiraditya

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311957 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-29 00:06:59 +00:00
Marek Sokolowski
233d2b81e8 [llvm-rc] Add MENU parsing ability (parser, pt 4/8).
This extends llvm-rc parsing tool by MENU resource
(msdn.microsoft.com/en-us/library/windows/desktop/aa381025(v=vs.85).aspx).
As for now, MENUEX
(msdn.microsoft.com/en-us/library/windows/desktop/aa381023(v=vs.85).aspx)
seems unnecessary.

Thanks for Nico Weber for his original work in this area.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311956 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 23:46:30 +00:00
Justin Bogner
cc308a0615 [sanitizer-coverage] Return the array from CreatePCArray. NFC
Be more consistent with CreateFunctionLocalArrayInSection in the API
of CreatePCArray, and assign the member variable in the caller like we
do for the guard and 8-bit counter arrays.

This also tweaks the order of method declarations to match the order
of definitions in the file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311955 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 23:46:11 +00:00
Justin Bogner
77eed38ae2 [sanitizer-coverage] Clean up trailing whitespace. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311954 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 23:38:12 +00:00
Juergen Ributzka
5f69ca899a Revert "Fix cmake check for futimens when deploying to earlier macOS releases."
This reverts r311949. The ARM bots don't like it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311953 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 23:24:03 +00:00
Adrian Prantl
66282c2c6a Fix a logic error in DwarfExpression::addMachineReg()
This fixes PR34323 and thus splitting undescribable registers into
smaller, describable sub-registers.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311951 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 23:07:43 +00:00
Juergen Ributzka
cf4d263198 Fix cmake check for futimens when deploying to earlier macOS releases.
macOS 10.13 added a new API (futimens). This API is only available on macOS 10.13
and later, but the cmake check we have in place only tests if the symbol is
present and ignores the availability attribute. Luckily we have new warning for
this and by making this warning an error the cmake check will return the correct
result.

See also rdar://problem/33992750.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311949 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 23:04:38 +00:00
Adam Nemet
0827f9ac83 Remove an unnecessary const_cast.
I think that this is dating back to when emit used to take a const reference.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311948 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 23:00:13 +00:00
Marek Sokolowski
66c13b13ca [llvm-rc] Add ACCELERATORS parsing ability. (parser, pt 3/8).
This improves the current llvm-rc parser by the ability of parsing
ACCELERATORS statement.

Moreover, some small improvements to the original parsing commit
were made.

Thanks for Nico Weber for his original work in this area.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311946 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 22:58:31 +00:00
Evandro Menezes
12cc150c84 [AArch64] Adjust the cost model for Exynos M1 and M2
Add new predicate to more accurately model the scheduling around branches
and function calls and of loads and stores of pairs and integer
multiplications.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311944 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 22:51:52 +00:00
Evandro Menezes
b1f57a78ba [AArch64] Adjust the cost model for Exynos M1 and M2
Add new predicate to more accurately model the cost of arithmetic and
logical operations shifted left.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311943 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 22:51:32 +00:00
Kamil Rytarowski
6358f3836e Define NetBSD/amd64 ASAN Shadow Offset
Summary:
Catch up after compiler-rt changes and define kNetBSD_ShadowOffset64
as (1ULL << 46).
 
Sponsored by <The NetBSD Foundation>

Reviewers: kcc, joerg, filcab, vitalybuka, eugenis

Reviewed By: eugenis

Subscribers: llvm-commits, #sanitizers

Tags: #sanitizers

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311941 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 22:13:52 +00:00
Craig Topper
ccba49dfc2 [InstCombine] Teach select01 helper of foldSelectIntoOp to handle vector splats
We were handling some vectors in foldSelectIntoOp, but not if the operand of the bin op was any kind of vector constant. This patch fixes it to treat vector splats the same as scalars.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311940 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 22:00:27 +00:00
Marek Sokolowski
f2e5589b0f [llvm-rc] Add ICON and HTML parsing ability (parser, pt 2/8).
This extends the current llvm-rc parser by ICON and HTML resources.
Moreover, some tests have been slightly rewritten.

Thanks for Nico Weber for his original work in this area.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311939 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 21:59:54 +00:00
Sanjay Patel
cd4a7cd9dc [InstCombine] add tests to show failure of SimplifyDemandedVectorElts + shuffle combining; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311934 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 21:14:26 +00:00
Geoff Berry
0f7a757315 [AArch64][Falkor] Avoid generating STRQro* instructions
Summary:
STRQro* instructions are slower than the alternative ADD/STRQui expanded
instructions on Falkor, so avoid generating them unless we're optimizing
for code size.

Reviewers: t.p.northover, mcrosier

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311931 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 20:48:43 +00:00
Davide Italiano
5e8dffb156 [LoopUnroll] Properly update loop structure in case of successful peeling.
When peeling kicks in, it updates the loop preheader.
Later, a successful full unroll of the loop needs to update a PHI
which i-th argument comes from the loop preheader, so it'd better look
at the correct block. Fixes PR33437.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311922 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 20:29:33 +00:00
Joerg Sonnenberger
eb8f624e3d Fix ARMv4 support
ARMv4 doesn't support the "BX" instruction, which has been introduced
with ARMv4t. Adjust the call lowering and tail call implementation
accordingly.

Further changes are necessary to ensure that presence of the v4t feature
is correctly set. Most importantly, the "generic" CPU for thumb-*
triples should include ARMv4t, since thumb mode without thumb support
would naturally be pointless.

Add a couple of asserts to ensure thumb instructions are not emitted
without CPU support.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311921 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 20:20:47 +00:00
Matthias Braun
1047945a59 Try to fix compilation problem with libstdc++
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311918 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 20:11:28 +00:00
Matthias Braun
7dc0bf2675 Address r311914 review comments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311917 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 20:11:27 +00:00
Davide Italiano
628b9ff95d [LoopUnroll] Add a cl::opt to force peeling, for testing purposes.
Will be used to test the patch proposed in D37153.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311915 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 19:50:55 +00:00
Matthias Braun
863f34946c TableGen: Fix subreg composition/concatenation
This fixes 2 problems in subregister hierarchies with multiple levels
and tuples:

1) For bigger tuples computing secondary subregs would miss 2nd order
effects.  In the test case a register like `S10_S11_S12_S13_S14` with D5
= S10_S11, D6 = S12_S13 we would correctly compute sub0 = D5, sub1 = D6
but would miss the fact that we could now form ssub0_ssub1_ssub2_ssub3
(aka sub0_sub1) = D5_D6. This is fixed by changing
computeSecondarySubRegs() to compute a fixpoint.

2) Fixing 1) exposed a problem where TableGen would create multiple
names for effectively the same subregister index. In the test case
the subregister index sub0 is composed from ssub0 and ssub1, and sub1 is
composed from ssub2 and ssub3. TableGen should not create both sub0_sub1
and ssub0_ssub1_ssub2_ssub3 as infered subregister indexes. This changes
the code to build a transitive closure of the subregister components
before forming new concatenated subregister indexes.

This fix was developed for an out of tree target. For the in-tree
targets the only change is in the register information computed for ARM.
There is a slight chance this fixed/improved some register coalescing
around the QQQQ/QQ register classes there but I couldn't see/provoke any
code generation differences.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311914 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 19:48:42 +00:00
Matthias Braun
8c42b74f86 TableGen: Add -gen-register-info-debug-dump
Adds a new --gen-register-info-debug-dump mode to tablegen that dumps various register related information:

- List of register classes with super and subclasses
- List of subregister indexes with lanemasks
- List of registers with subregisters

I will use this in an upcoming commit to create a test.

It may also be useful for target developers wanting to get an overview
of all the register related information, esp. the things inferred by
tablegen and not directly visible in the .td file.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311913 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 19:48:40 +00:00
Geoff Berry
363f0068dd [ARM] Fix bug in ARMLoadStoreOptimizer when kill flags are missing.
Summary:
ARMLoadStoreOpt::FixInvalidRegPairOp() was only checking if one of the
load destination registers to be split overlapped with the base register
if the base register was marked as killed.  Since kill flags may not
always be present, this can lead to incorrect code.

This bug was exposed by my MachineCopyPropagation change D30751 breaking
the sanitizer-x86_64-linux-android buildbot.

Also clean up some dead code and add an assert that a register offset is
never encountered by this code, since it does not handle them correctly.

Reviewers: MatzeB, qcolombet, t.p.northover

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311907 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 19:03:45 +00:00
Taewook Oh
2dc1928441 Create PHI node for the return value only when the return value has uses.
Summary:
Currently, a phi node is created in the normal destination to unify the return values from promoted calls and the original indirect call. This patch makes this phi node to be created only when the return value has uses.

This patch is necessary to generate valid code, as compiler crashes with the attached test case without this patch. Without this patch, an illegal phi node that has no incoming value from `entry`/`catch` is created in `cleanup` block.

I think existing implementation is good as far as there is at least one use of the original indirect call. `insertCallRetPHI` creates a new phi node in the normal destination block only when the original indirect call dominates its use and the normal destination block. Otherwise, `fixupPHINodeForNormalDest` will handle the unification of return values naturally without creating a new phi node. However, if there's no use, `insertCallRetPHI` still creates a new phi node even when the original indirect call does not dominate the normal destination block, because `getCallRetPHINode` returns false.

Reviewers: xur, davidxl, danielcdh

Reviewed By: xur

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311906 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 18:57:00 +00:00
Zachary Turner
fc50e1c612 [CodeView] Don't output S_UDT symbols for forward decls.
S_UDT symbols are the debugger's "index" for all the structs,
typedefs, classes, and enums in a program.  If any of those
structs/classes don't have a complete declaration, or if there
is a typedef to something that doesn't have a complete definition,
then emitting the S_UDT is unhelpful because it doesn't give
the debugger enough information to do anything useful.  On the
other hand, it results in a huge size blow-up in the resulting
PDB, which is exacerbated by an order of magnitude when linking
with /DEBUG:FASTLINK.

With this patch, we drop S_UDT records for types that refer either
directly or indirectly (e.g. through a typedef, pointer, etc) to
a class/struct/union/enum without a complete definition.  This
brings us about 50% of the way towards parity with /DEBUG:FASTLINK
PDBs generated from cl-compiled object files.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311904 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 18:49:04 +00:00
Stefan Pintilie
8ecaf1929f [Power9] Add new instructions for floating point status and control registers.
Added the following P9 instructions: mffsce, mffscdrn, mffscdrni, mffscrn,
  mffscrni, mffsl

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311903 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 18:46:01 +00:00
Craig Topper
a3ced95cbe [InstCombine] Call hasNoSignedWrap instead of hasNoUnsignedWrap to get the NSW flag when handling Add in SimplifyDemandedUseBits.
This is a typo from r311789.

This should fix PR34349.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311902 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 18:44:28 +00:00
Krzysztof Parzyszek
a0dd08a806 [Hexagon] Check for potential bank conflicts in post-RA scheduling
Insert artificial edges between loads that could cause a cache bank
conflict.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311901 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 18:36:21 +00:00
Stanislav Mekhanoshin
9324a77aa4 [AMDGPU] Fix regression in AMDGPULibCalls allowing native for doubles
Under -cl-fast-relaxed-math we could use native_sqrt, but f64 was
allowed to produce HSAIL's nsqrt instruction. HSAIL is not here
and we stick with non-existing native_sqrt(double) as a result.

Add check for f64 to not return native functions and also remove
handling of f64 case for fold_sqrt.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311900 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 18:00:08 +00:00
Stanislav Mekhanoshin
f4dd1bdd9a [AMDGPU] computeKnownBitsForTargetNode for 24 bit mul
Differential Revision: https://reviews.llvm.org/D37168

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311896 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 16:35:37 +00:00
Krzysztof Parzyszek
30898f12ad [Hexagon] Break up DAG mutations into separate classes, move to subtarget
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311895 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 16:24:22 +00:00
Krzysztof Parzyszek
891663db21 [Hexagon] Move pre-RA DAG mutations to scheduler constructor
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311894 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 15:52:54 +00:00
Craig Topper
24aa0d9dbf [X86] Make 128/256-bit extract_subvector Legal instead of Custom. Move combining with BUILD_VECTOR from Legalization to DAG combine
EXTRACT_SUBVECTOR was marked Custom solely so we could combine it with BUILD_VECTOR operations to create smaller BUILD_VECTORS during Legalization. But that sort of combining should really be done by the DAG combiner.

This patch adds the last piece of needed supported DAG combine to handle this. Once that's done we can make the EXTRACT_SUBVECTOR operations Legal.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311893 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 15:32:50 +00:00
Craig Topper
337c2dfa0b [DAGCombiner] Teach visitEXTRACT_SUBVECTOR to turn extracts of BUILD_VECTOR into smaller BUILD_VECTORs
Only do this before operations are legalized of BUILD_VECTOR is Legal for the target.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311892 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 15:28:33 +00:00
Ilya Biryukov
a6b4f0552f Changed Dockerfiles to install LLVM into /usr/local
Summary:
Previously, the installation path was simply '/'.
Using '/usr/local' would ensure that LLVM installation does not
conflict with software installed via package managers.

Reviewers: mehdi_amini, klimek

Reviewed By: klimek

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311890 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 15:12:24 +00:00
Evgeny Mankov
dc57c3f759 [Support][CommandLine] Add cl::Option::setDefault()
Add abstract virtual method setDefault() to class Option and implement it in its inheritors in order to be able to set all the options to its default values in user's code without actually knowing all these options. For instance:

for (auto &OM : cl::getRegisteredOptions(*cl::TopLevelSubCommand)) {
  cl::Option *O = OM.second;
  O->setDefault();
}

Reviewed by: rampitec, Eugene.Zelenko, kasaurov

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311887 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 13:39:43 +00:00
Andrew V. Tischenko
384007e569 The current version of LLVM X86 disassembler incorrectly interprets some possible sets of x86 prefixes. This patch is the first step to close PR7709 and PR17697. There will be next patch(es) to close relative PRs.
Differential Revision: https://reviews.llvm.org/D36788

M    lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp
M    lib/Target/X86/Disassembler/X86DisassemblerDecoder.h
A    test/MC/Disassembler/X86/prefixes-i386.s
A    test/MC/Disassembler/X86/prefixes-x86_64.s
M    test/MC/Disassembler/X86/prefixes.txt


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311882 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 10:43:14 +00:00
Gadi Haber
b123fd02f9 [X86][Haswell] Updating HSW instruction scheduling information
This patch completely replaces the instruction scheduling information for the Haswell architecture target by modifying the file X86SchedHaswell.td located under the X86 Target.
We used the scheduling information retrieved from the Haswell architects in order to replace and modify the existing scheduling.
The patch continues the scheduling replacement effort started with the SNB target in r307529 and r310792.
Information includes latency, number of micro-Ops and used ports by each HSW instruction.

Please expect some performance fluctuations due to code alignment effects.

Reviewers: RKSimon, zvi, aymanmus, craig.topper, m_zuckerman, igorb, dim, chandlerc, aaboud

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311879 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 10:04:16 +00:00
NAKAMURA Takumi
d60caed503 Prune whitespaces in blank lines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311876 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 07:48:37 +00:00
NAKAMURA Takumi
ef15f2cc89 Untabify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311875 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 06:47:47 +00:00
Craig Topper
038b487112 [X86] Use getUnpackl helper to create an ISD::VECTOR_SHUFFLE instead of using X86ISD::UNPCKL in reduceVMULWidth.
This runs fairly early, we should use target independent nodes if possible.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311873 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 05:14:38 +00:00
Craig Topper
5aa44202c0 [X86] Add an early out to combineLoopMAddPattern and combineLoopSADPattern when SSE2 is disabled.
Without this the madd.ll and sad.ll test cases both throw assertions if you run them with SSE2 disabled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311872 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 04:29:08 +00:00
Lang Hames
68a7b2d85a [Error] Add a handleExpected utility.
handleExpected is similar to handleErrors, but takes an Expected<T> as its first
input value and a fallback functor as its second, followed by an arbitary list
of error handlers (equivalent to the handler list of handleErrors). If the first
input value is a success value then it is returned from handleErrors
unmodified. Otherwise the contained error(s) are passed to handleErrors, along
with the handlers. If handleErrors returns success (indicating that all errors
have been handled) then handleExpected runs the fallback functor and returns its
result. If handleErrors returns a failure value then the failure value is
returned and the fallback functor is never run.

This simplifies the process of re-trying operations that return Expected values.
Without this utility such retry logic is cumbersome as the internal Error must
be explicitly extracted from the Expected value, inspected to see if its
handleable and then consumed:

enum FooStrategy { Aggressive, Conservative };
Expected<Foo> tryFoo(FooStrategy S);

Expected<Foo> Result;
(void)!!Result; // "Check" Result so that it can be safely overwritten.
if (auto ValOrErr = tryFoo(Aggressive))
  Result = std::move(ValOrErr);
else {
  auto Err = ValOrErr.takeError();
  if (Err.isA<HandleableError>()) {
    consumeError(std::move(Err));
    Result = tryFoo(Conservative);
  } else
    return std::move(Err);
}

with handleExpected, this can be re-written as:

auto Result =
  handleExpected(
    tryFoo(Aggressive),
    []() { return tryFoo(Conservative); },
    [](HandleableError&) { /* discard to handle */ });



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311870 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 03:36:46 +00:00
Dehao Chen
3607b8f0f2 revert r310985 which breaks for the following case:
struct string {
  ~string();
};
void f2();
void f1(int) { f2(); }
void run(int c) {
  string body;
  while (true) {
    if (c)
      f1(c);
    else
      f1(c);
  }
}

Will recommit once the issue is fixed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311864 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-27 22:22:39 +00:00
Petar Jovanovic
8679b1f292 [mips] Generate NMADD and NMSUB instructions when fneg node is present
This patch enables generation of NMADD and NMSUB instructions when fneg node
is present. These instructions are currently only generated if fsub node is
present.

Patch by Stanislav Ocovaj.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311862 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-27 21:07:24 +00:00
Javed Absar
3009eea8bb [ARM] Tidy-up condition-code support functions
Move condition code support functions to Utils and remove code duplication.

Reviewed by: @fhahn, @asb
Differential Revision: https://reviews.llvm.org/D37179



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311860 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-27 20:38:28 +00:00
Craig Topper
af63a49b5d [AVX512] Add more patterns for using masked moves for subvector extracts of the lowest subvector. This time with bitcasts between the vselect and the extract.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311856 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-27 19:03:36 +00:00
Sanjay Patel
3d4355f5e5 [DAGCombiner] allow undef shuffle operands when eliminating bitcasts (PR34111)
As noted in the FIXME, this could be improved more, but this is the smallest fix
that helps:
https://bugs.llvm.org/show_bug.cgi?id=34111


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311853 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-27 17:29:30 +00:00