]> granicus.if.org Git - llvm/log
llvm
5 years ago[BPF] Remove unused variables. NFCI.
Simon Pilgrim [Thu, 26 Sep 2019 10:55:57 +0000 (10:55 +0000)]
[BPF] Remove unused variables. NFCI.

Fixes a dyn_cast<> null dereference warning.

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

5 years ago[MIPS GlobalISel] Lower aggregate structure return arguments
Petar Avramovic [Thu, 26 Sep 2019 10:48:07 +0000 (10:48 +0000)]
[MIPS GlobalISel] Lower aggregate structure return arguments

Implement aggregate structure split to simpler types in splitToValueTypes.
splitToValueTypes is used for return values.
According to MipsABIInfo from clang/lib/CodeGen/TargetInfo.cpp,
aggregate structure arguments for O32 always get simplified and thus
will remain unsupported by the MIPS GlobalISel for the time being.
For O32, aggregate structures can be encountered only for complex number
returns e.g. 'complex float' or 'complex double' from <complex.h>.

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

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

5 years agoHexagonAsmParser::ParseDirectiveFalign - silence static analyzer dyn_cast<MCConstantE...
Simon Pilgrim [Thu, 26 Sep 2019 10:35:19 +0000 (10:35 +0000)]
HexagonAsmParser::ParseDirectiveFalign - silence static analyzer dyn_cast<MCConstantExpr> null dereference warning. NFCI.

The static analyzer is warning about a potential null dereference, but we should be able to use cast<MCConstantExpr> directly and if not assert will fire for us.

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

5 years ago[SLPVectorizer][X86] Add SSE common check prefix to let us merge SSE2+SLM checks
Simon Pilgrim [Thu, 26 Sep 2019 10:23:57 +0000 (10:23 +0000)]
[SLPVectorizer][X86] Add SSE common check prefix to let us merge SSE2+SLM checks

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

5 years ago[CostModel][X86] Fix SLM <2 x i64> icmp costs
Simon Pilgrim [Thu, 26 Sep 2019 10:14:38 +0000 (10:14 +0000)]
[CostModel][X86] Fix SLM <2 x i64> icmp costs

SLM is 2 x slower for <2 x i64> comparison ops than other vector types, we should account for this like we do for SLM <2 x i64> add/sub/mul costs.

This should remove some of the SLM codegen diffs in D43582

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

5 years ago[SystemZ] Recognize mnop-mcount in backend
Jonas Paulsson [Thu, 26 Sep 2019 08:38:07 +0000 (08:38 +0000)]
[SystemZ]  Recognize mnop-mcount in backend

With -pg -mfentry -mnop-mcount, a nop is emitted instead of the call to
fentry.

Review: Ulrich Weigand
https://reviews.llvm.org/D67765

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

5 years ago[X86] Remove isCodeGenOnly from (V)ROUND.*_Int and put it on the non _Int form instead.
Craig Topper [Thu, 26 Sep 2019 07:27:26 +0000 (07:27 +0000)]
[X86] Remove isCodeGenOnly from (V)ROUND.*_Int and put it on the non _Int form instead.

This matches what's done for VRNDSCALE and most other instructions.

This mainly determines which instruction will be preferred by
disassembler and assembly parser. The printing and encoding
information is the same.

We prefer the _Int form since it uses the VR128 class due to
intrinsic interface. For some of EVEX features like embedded
rounding, we only select from intrinsics today. So there is
only a VR128 version. So making the VR128 version the preferred
is overally consistent.

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

5 years ago [IfConversion] Disallow TBB == FBB for valid triangles
Mikael Holmen [Thu, 26 Sep 2019 06:35:55 +0000 (06:35 +0000)]
 [IfConversion] Disallow TBB == FBB for valid triangles

Summary:
Previously the case

     EBB
     | \_
     |  |
     | TBB
     |  /
     FBB

was treated as a valid triangle also when TBB and FBB was the same basic
block. This could then lead to an invalid CFG when we removed the edge
from EBB to TBB, since that meant we would also remove the edge from EBB
to FBB.

Since TBB == FBB is quite a degenerated case of a triangle, we now
don't treat it as a valid triangle anymore, and thus we will avoid the
trouble with updating the CFG.

Reviewers: efriedma, dmgreen, kparzysz

Reviewed By: efriedma

Subscribers: bjope, hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[X86] Mark the EVEX encoded PSADBW instructions as commutable to enable load folding...
Craig Topper [Thu, 26 Sep 2019 04:42:58 +0000 (04:42 +0000)]
[X86] Mark the EVEX encoded PSADBW instructions as commutable to enable load folding of the other operand.

The SSE and VEX versions are already correct.

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

5 years ago[ConstantFolding] Use FoldBitCast correctly
Keno Fischer [Thu, 26 Sep 2019 02:07:51 +0000 (02:07 +0000)]
[ConstantFolding] Use FoldBitCast correctly

Previously we might attempt to use a BitCast to turn bits into vectors of pointers,
but that requires an inttoptr cast to be legal. Add an assertion to detect the formation of illegal bitcast attempts
early (in the tests, we often constant-fold away the result before getting to this assertion check),
while being careful to still handle the early-return conditions without adding extra complexity in the result.

Patch by Jameson Nash <jameson@juliacomputing.com>.

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

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

5 years agoImprove C API support for atomicrmw and cmpxchg.
Nick Lewycky [Thu, 26 Sep 2019 00:58:55 +0000 (00:58 +0000)]
Improve C API support for atomicrmw and cmpxchg.

atomicrmw and cmpxchg have a volatile flag, so allow them to be get and set with LLVM{Get,Set}Volatile. atomicrmw and fence have orderings, so allow them to be get and set with LLVM{Get,Set}Ordering. Add missing LLVMAtomicRMWBinOpFAdd and LLVMAtomicRMWBinOpFSub enum constants. AtomicCmpXchg also has a weak flag, add a getter/setter for that too. Add a getter/setter for the binary-op of an atomicrmw.

atomicrmw and cmpxchg have a volatile flag, so allow it to be set/get with LLVMGetVolatile and LLVMSetVolatile. Add missing LLVMAtomicRMWBinOpFAdd and LLVMAtomicRMWBinOpFSub enum constants. AtomicCmpXchg also has a weak flag, add a getter/setter for that too. Add a getter/setter for the binary-op of an atomicrmw.

Add LLVMIsA## for CatchSwitchInst, CallBrInst and FenceInst, as well as AtomicCmpXchgInst and AtomicRMWInst.

Update llvm-c-test to include atomicrmw and fence, and to copy volatile for the four applicable instructions.

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

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

5 years ago[TargetLowering] Make allowsMemoryAccess methode virtual.
Thomas Raoux [Thu, 26 Sep 2019 00:16:01 +0000 (00:16 +0000)]
[TargetLowering] Make allowsMemoryAccess methode virtual.

Rename old function to explicitly show that it cares only about alignment.
The new allowsMemoryAccess call the function related to alignment by default
and can be overridden by target to inform whether the memory access is legal or
not.

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

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

5 years ago[MC][WebAssembly] Error on data symbols in the text section.
Sam Clegg [Wed, 25 Sep 2019 23:33:16 +0000 (23:33 +0000)]
[MC][WebAssembly] Error on data symbols in the text section.

Previously we had an assert but this can actually occur in valid user
code so we need to handle this in release builds too.

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

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

5 years ago[X86] Use VR512_0_15RegClass intead of VR512RegClass in X86VZeroUpper.
Craig Topper [Wed, 25 Sep 2019 23:25:15 +0000 (23:25 +0000)]
[X86] Use VR512_0_15RegClass intead of VR512RegClass in X86VZeroUpper.

This pass is only concerned with ZMM0-15 and YMM0-15. For YMM
we use VR256 which only contains YMM0-15, but for ZMM we were
using VR512 which contains ZMM0-31. Using VR512_0_15 is more
correct.

Given that the ABI and register allocator will use registers in
order, its unlikely that register from 16-31 would be used
without also using 0-15. So this probably doesn't functionally
matter.

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

5 years ago[MemorySSA] Avoid adding Phis in the presence of unreachable blocks.
Alina Sbirlea [Wed, 25 Sep 2019 23:24:39 +0000 (23:24 +0000)]
[MemorySSA] Avoid adding Phis in the presence of unreachable blocks.

Summary:
If a block has all incoming values with the same MemoryAccess (ignoring
incoming values from unreachable blocks), then use that incoming
MemoryAccess and do not create a Phi in the first place.

Revert IDF work-around added in rL372673; it should not be required unless
the Def inserted is the first in its block.

The patch also cleans up a series of tests, added during the many
iterations on insertDef.

The patch also fixes PR43438.
The same issue that occurs in insertDef with "adding phis, hence the IDF of
Phis is needed", can also occur in fixupDefs: the `getPreviousRecursive`
call only adds Phis walking on the predecessor edges, which means there
may be the case of a Phi added walking the CFG "backwards" which
triggers the needs for an additional Phi in successor blocks.
Such Phis are added during fixupDefs only in the presence of unreachable
blocks.
Hence this highlights the need to avoid adding Phis in blocks with
unreachable predecessors in the first place.

Reviewers: george.burgess.iv

Subscribers: Prazek, sanjoy.google, llvm-commits

Tags: #llvm

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

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

5 years ago[InstCombine] foldUnsignedUnderflowCheck(): one last pattern with 'sub' (PR43251)
Roman Lebedev [Wed, 25 Sep 2019 22:59:59 +0000 (22:59 +0000)]
[InstCombine] foldUnsignedUnderflowCheck(): one last pattern with 'sub' (PR43251)

https://rise4fun.com/Alive/0j9

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

5 years ago[NFC][InstCombine] Tests for 'base u<= offset && (base - offset) != 0' pattern (PR43251)
Roman Lebedev [Wed, 25 Sep 2019 22:59:48 +0000 (22:59 +0000)]
[NFC][InstCombine] Tests for 'base u<= offset && (base - offset) != 0' pattern (PR43251)

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

5 years ago[InstSimplify] Handle more 'A </>/>=/<= B &&/|| (A - B) !=/== 0' patterns (PR43251)
Roman Lebedev [Wed, 25 Sep 2019 22:59:41 +0000 (22:59 +0000)]
[InstSimplify] Handle more 'A </>/>=/<= B &&/|| (A - B) !=/== 0' patterns (PR43251)

https://rise4fun.com/Alive/sl9s
https://rise4fun.com/Alive/2plN

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

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

5 years ago[NFC][InstSimplify] More exaustive test coverage for 'A </>/>=/<= B &&/|| (A - B...
Roman Lebedev [Wed, 25 Sep 2019 22:59:24 +0000 (22:59 +0000)]
[NFC][InstSimplify] More exaustive test coverage for 'A </>/>=/<= B &&/|| (A - B) !=/== 0' pattern (PR43251)

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

5 years ago[LICM] Don't verify domtree/loopinfo unless EXPENSIVE_CHECKS is enabled.
Eli Friedman [Wed, 25 Sep 2019 22:35:47 +0000 (22:35 +0000)]
[LICM] Don't verify domtree/loopinfo unless EXPENSIVE_CHECKS is enabled.

For large functions, verifying the whole function after each loop takes
non-linear time.

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

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

5 years ago[Verifier] add invariant check for callbr
Nick Desaulniers [Wed, 25 Sep 2019 22:28:27 +0000 (22:28 +0000)]
[Verifier] add invariant check for callbr

Summary:
The list of indirect labels should ALWAYS have their blockaddresses as
argument operands to the callbr (but not necessarily the other way
around).  Add an invariant that checks this.

The verifier catches a bad test case that was added recently in r368478.
I think that was a simple mistake, and the test was made less strict in
regards to the precise addresses (as those weren't specifically the
point of the test).

This invariant will be used to find a reported bug.

Link: https://www.spinics.net/lists/arm-kernel/msg753473.html
Link: https://github.com/ClangBuiltLinux/linux/issues/649
Reviewers: craig.topper, void, chandlerc

Reviewed By: void

Subscribers: ychen, lebedev.ri, javed.absar, kristof.beyls, hiraditya, llvm-commits, srhines

Tags: #llvm

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

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

5 years ago[InstSimplify] Match 1.0 and 0.0 for both operands in SimplifyFMAMul
Florian Hahn [Wed, 25 Sep 2019 19:33:26 +0000 (19:33 +0000)]
[InstSimplify] Match 1.0 and 0.0 for both operands in SimplifyFMAMul

Because we do not constant fold multiplications in SimplifyFMAMul,
we match 1.0 and 0.0 for both operands, as multiplying by them
is guaranteed to produce an exact result (if it is allowed to do so).

Note that it is not enough to just swap the operands to ensure a
constant is on the RHS, as we want to also cover the case with
2 constants.

Reviewers: lebedev.ri, spatel, reames, scanon

Reviewed By: lebedev.ri, reames

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

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

5 years ago[InstCombine] Fold (A - B) u>=/u< A --> B u>/u<= A iff B != 0
Roman Lebedev [Wed, 25 Sep 2019 19:06:40 +0000 (19:06 +0000)]
[InstCombine] Fold  (A - B) u>=/u< A  --> B  u>/u<= A  iff B != 0

https://rise4fun.com/Alive/KtL

This also shows that the fold added in D67412 / r372257
was too specific, and the new fold allows those test cases
to be handled more generically, therefore i delete now-dead code.

This is yet again motivated by
D67122 "[UBSan][clang][compiler-rt] Applying non-zero offset to nullptr is undefined behaviour"

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

5 years ago[NFC][InstCombine] Add tests for (X - Y) < X --> Y <= X iff Y != 0
Roman Lebedev [Wed, 25 Sep 2019 19:06:26 +0000 (19:06 +0000)]
[NFC][InstCombine] Add tests for (X - Y) < X  -->  Y <= X  iff  Y != 0

https://rise4fun.com/Alive/KtL
This should go to InstCombiner::foldICmpBinO(), next to
"Convert sub-with-unsigned-overflow comparisons into a comparison of args."

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

5 years ago[MSP430] Allow msp430_intrcc functions to not have interrupt attribute.
Vadzim Dambrouski [Wed, 25 Sep 2019 18:58:07 +0000 (18:58 +0000)]
[MSP430] Allow msp430_intrcc functions to not have interrupt attribute.

Summary:
Useful in case you want to have control over interrupt vector generation.
For example in Rust language we have an arrangement where all unhandled
ISR vectors gets mapped to a single default handler function. Which is
hard to implement when LLVM tries to generate vectors on its own.

Reviewers: asl, krisb

Subscribers: hiraditya, JDevlieghere, awygle, llvm-commits

Tags: #llvm

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

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

5 years ago[AMDGPU] Improve fma.f64 test. NFC.
Stanislav Mekhanoshin [Wed, 25 Sep 2019 18:50:34 +0000 (18:50 +0000)]
[AMDGPU] Improve fma.f64 test. NFC.

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

5 years ago[AMDGPU] gfx10 v_fmac_f16 operand folding
Stanislav Mekhanoshin [Wed, 25 Sep 2019 18:40:20 +0000 (18:40 +0000)]
[AMDGPU] gfx10 v_fmac_f16 operand folding

Fold immediates into v_fmac_f16.

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

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

5 years ago[emacs] simplify and improve keyword highlighting in tablegen-mode.el
Bob Haarman [Wed, 25 Sep 2019 18:16:02 +0000 (18:16 +0000)]
[emacs] simplify and improve keyword highlighting in tablegen-mode.el

Summary:
The keyword and type keyword matchers in tablegen-mode.el checked
for space, newline, tab, or open paren after the regular expression
that matches keywords (or type keywords, respectively). This is
unnecessary, because those regular expressions already include word
boundaries. This change removes the extra check. This also causes
"def" in "def:" to be highlighted as a keyword, which was missed
before.

Reviewers: lattner, MaskRay

Reviewed By: MaskRay

Subscribers: llvm-commits

Tags: #llvm

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

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

5 years ago[NFC] Add { } to silence compiler warning [-Wmissing-braces].
Huihui Zhang [Wed, 25 Sep 2019 17:32:20 +0000 (17:32 +0000)]
[NFC] Add { } to silence compiler warning [-Wmissing-braces].

llvm-project/llvm/unittests/ADT/ArrayRefTest.cpp:254:25: warning: suggest braces around initialization of subobject [-Wmissing-braces]
  std::array<int, 5> A1{42, -5, 0, 1000000, -1000000};
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
                        {                           }

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

5 years ago[InstCombine] Limit FMul constant folding for fma simplifications.
Florian Hahn [Wed, 25 Sep 2019 17:03:20 +0000 (17:03 +0000)]
[InstCombine] Limit FMul constant folding for fma simplifications.

As @reames pointed out post-commit, rL371518 adds additional rounding
in some cases, when doing constant folding of the multiplication.
This breaks a guarantee llvm.fma makes and must be avoided.

This patch reapplies rL371518, but splits off the simplifications not
requiring rounding from SimplifFMulInst as SimplifyFMAFMul.

Reviewers: spatel, lebedev.ri, reames, scanon

Reviewed By: reames

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

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

5 years ago[AArch64][GlobalISel] Choose CCAssignFns per-argument for tail call lowering
Jessica Paquette [Wed, 25 Sep 2019 16:45:35 +0000 (16:45 +0000)]
[AArch64][GlobalISel] Choose CCAssignFns per-argument for tail call lowering

When checking for tail call eligibility, we should use the correct CCAssignFn
for each argument, rather than just checking if the caller/callee is varargs or
not.

This is important for tail call lowering with varargs. If we don't check it,
then basically any varargs callee with parameters cannot be tail called on
Darwin, for one thing. If the parameters are all guaranteed to be in registers,
this should be entirely safe.

On top of that, not checking for this could potentially make it so that we have
the wrong stack offsets when checking for tail call eligibility.

Also refactor some of the stuff for CCAssignFnForCall and pull it out into a
helper function.

Update call-translator-tail-call.ll to show that we can now correctly tail call
on Darwin. Also add two extra tail call checks. The first verifies that we still
respect the caller's stack size, and the second verifies that we still don't
tail call when a varargs function has a memory argument.

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

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

5 years ago[CodeGen] Replace -max-jump-table-size with -max-jump-table-targets
Evandro Menezes [Wed, 25 Sep 2019 16:10:20 +0000 (16:10 +0000)]
[CodeGen] Replace -max-jump-table-size with -max-jump-table-targets

Modern processors predict the targets of an indirect branch regardless of
the size of any jump table used to glean its target address.  Moreover,
branch predictors typically use resources limited by the number of actual
targets that occur at run time.

This patch changes the semantics of the option `-max-jump-table-size` to limit
the number of different targets instead of the number of entries in a jump
table.  Thus, it is now renamed to `-max-jump-table-targets`.

Before, when `-max-jump-table-size` was specified, it could happen that
cluster jump tables could have targets used repeatedly, but each one was
counted and typically resulted in tables with the same number of entries.
With this patch, when specifying `-max-jump-table-targets`, tables may have
different lengths, since the number of unique targets is counted towards the
limit, but the number of unique targets in tables is the same, but for the
last one containing the balance of targets.

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

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

5 years ago[LangRef] Clarify absence of rounding guarantees for fmuladd.
Florian Hahn [Wed, 25 Sep 2019 16:09:24 +0000 (16:09 +0000)]
[LangRef] Clarify absence of rounding guarantees for fmuladd.

During the review of D67434, it was recommended to make fmuladd's
behavior more explicit. D67434 depends on this interpretation.

Reviewers: efriedma, jfb, reames, scanon, lebedev.ri, spatel

Reviewed By: spatel

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

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

5 years ago[DAGCombiner] add one-use restriction to vector transform with cheap extract
Sanjay Patel [Wed, 25 Sep 2019 15:08:33 +0000 (15:08 +0000)]
[DAGCombiner] add one-use restriction to vector transform with cheap extract

We might be able to do better on the example in the test,
but in general, we should not scalarize a splatted vector
binop if there are other uses of the binop. Otherwise, we
can end up with code as we had - a scalar op that is
redundant with a vector op.

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

5 years ago[PatternMatch] Make m_Br more flexible, add matchers for BB values.
Florian Hahn [Wed, 25 Sep 2019 15:05:08 +0000 (15:05 +0000)]
[PatternMatch] Make m_Br more flexible, add matchers for BB values.

Currently m_Br only takes references to BasicBlock*, which limits its
flexibility. For example, you have to declare a variable, even if you
ignore the result or you have to have additional checks to make sure the
matched BB matches an expected one.

This patch adds m_BasicBlock and m_SpecificBB matchers, which can be
used like the existing matchers for constants or values.

I also had a look at the existing uses and updated a few. IMO it makes
the code a bit more explicit.

Reviewers: spatel, craig.topper, RKSimon, majnemer, lebedev.ri

Reviewed By: lebedev.ri

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

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

5 years ago[x86] add test for multi-use scalarization of vector binop; NFC
Sanjay Patel [Wed, 25 Sep 2019 14:57:45 +0000 (14:57 +0000)]
[x86] add test for multi-use scalarization of vector binop; NFC

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

5 years ago[TargetInstrInfo] Let findCommutedOpIndices take const MachineInstr&
Simon Pilgrim [Wed, 25 Sep 2019 14:55:57 +0000 (14:55 +0000)]
[TargetInstrInfo] Let findCommutedOpIndices take const MachineInstr&

Neither the base implementation of findCommutedOpIndices nor any in-tree target modifies the instruction passed in and there is no reason why they would in the future.

Committed on behalf of @hvdijk (Harald van Dijk)

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

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

5 years ago[PatternMatch] Generalize brc_match (NFC).
Florian Hahn [Wed, 25 Sep 2019 14:53:06 +0000 (14:53 +0000)]
[PatternMatch] Generalize brc_match (NFC).

Preparation for D68013.

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

5 years ago[IR] allow fast-math-flags on phi of FP values (2nd try)
Sanjay Patel [Wed, 25 Sep 2019 14:35:02 +0000 (14:35 +0000)]
[IR] allow fast-math-flags on phi of FP values (2nd try)

The changes here are based on the corresponding diffs for allowing FMF on 'select':
D61917 <https://reviews.llvm.org/D61917>

As discussed there, we want to have fast-math-flags be a property of an FP value
because the alternative (having them on things like fcmp) leads to logical
inconsistency such as:
https://bugs.llvm.org/show_bug.cgi?id=38086

The earlier patch for select made almost no practical difference because most
unoptimized conditional code begins life as a phi (based on what I see in clang).
Similarly, I don't expect this patch to do much on its own either because
SimplifyCFG promptly drops the flags when converting to select on a minimal
example like:
https://bugs.llvm.org/show_bug.cgi?id=39535

But once we have this plumbing in place, we should be able to wire up the FMF
propagation and start solving cases like that.

The change to RecurrenceDescriptor::AddReductionVar() is required to prevent a
regression in a LoopVectorize test. We are intersecting the FMF of any
FPMathOperator there, so if a phi is not properly annotated, new math
instructions may not be either. Once we fix the propagation in SimplifyCFG, it
may be safe to remove that hack.

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

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

5 years agoFix analyzer TypeAttributeImpl::anchor() override.
Simon Pilgrim [Wed, 25 Sep 2019 14:23:25 +0000 (14:23 +0000)]
Fix analyzer TypeAttributeImpl::anchor() override.

TypeAttributeImpl inherits from EnumAttributeImpl which already defines anchor() as a virtual, so we should override this instead of redeclaring it.

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

5 years ago[gn build] Fix Python DeprecationWarning
Marco Antognini [Wed, 25 Sep 2019 14:15:34 +0000 (14:15 +0000)]
[gn build] Fix Python DeprecationWarning

Summary:
This fixes two issues:
 - DeprecationWarning: invalid escape sequence \`
 - ResourceWarning: unclosed file

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

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

5 years ago[Dominators][AMDGPU] Don't use virtual exit node in findNearestCommonDominator. Clean...
Jakub Kuderski [Wed, 25 Sep 2019 14:04:36 +0000 (14:04 +0000)]
[Dominators][AMDGPU] Don't use virtual exit node in findNearestCommonDominator. Cleanup MachinePostDominators.

Summary:
This patch fixes a bug that originated from passing a virtual exit block (nullptr) to `MachinePostDominatorTee::findNearestCommonDominator` and resulted in assertion failures inside its callee. It also applies a small cleanup to the class.

The patch introduces a new function in PDT that given a list of `MachineBasicBlock`s finds their NCD. The new overload of `findNearestCommonDominator` handles virtual root correctly.

Note that similar handling of virtual root nodes is not necessary in (forward) `DominatorTree`s, as right now they don't use virtual roots.

Reviewers: tstellar, tpr, nhaehnle, arsenm, NutshellySima, grosser, hliao

Reviewed By: hliao

Subscribers: hliao, kzhuravl, jvesely, wdng, yaxunl, dstuttard, t-tye, hiraditya, llvm-commits

Tags: #amdgpu, #llvm

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

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

5 years ago[SystemZ] Improve emitSelect()
Jonas Paulsson [Wed, 25 Sep 2019 14:00:33 +0000 (14:00 +0000)]
[SystemZ]  Improve emitSelect()

Merge more Select pseudo instructions in emitSelect() by allowing other
instructions between them as long as they do not clobber CC.

Debug value instructions are now moved down to below the new PHIs instead of
erasing them.

Review: Ulrich Weigand
https://reviews.llvm.org/D67619

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

5 years agoFix cppcheck variable shadow warning. NFCI.
Simon Pilgrim [Wed, 25 Sep 2019 13:45:36 +0000 (13:45 +0000)]
Fix cppcheck variable shadow warning. NFCI.

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

5 years agoAdd missing ExplicitTy default initialization to ConstantExprKeyType constructors.
Simon Pilgrim [Wed, 25 Sep 2019 13:38:54 +0000 (13:38 +0000)]
Add missing ExplicitTy default initialization to ConstantExprKeyType constructors.

Fixes cppcheck uninitialized variable warnings

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

5 years agoRevert [IR] allow fast-math-flags on phi of FP values
Sanjay Patel [Wed, 25 Sep 2019 13:29:09 +0000 (13:29 +0000)]
Revert [IR] allow fast-math-flags on phi of FP values

This reverts r372866 (git commit dec03223a97af0e4dfcb23da55c0f7f8c9b62d00)

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

5 years ago[llvm-readobj/llvm-readelf] - .stack_sizes: demangle symbol names in warnings reported.
George Rimar [Wed, 25 Sep 2019 13:16:43 +0000 (13:16 +0000)]
[llvm-readobj/llvm-readelf] - .stack_sizes: demangle symbol names in warnings reported.

I started this patch as a refactoring, tried to make a helper for
getting symbol names, similar to how we get section names
used in warning messages.

So this patch cleanups the code and fixes an issue: symbol names
in warning messages were not demangled.

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

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

5 years ago[IR] allow fast-math-flags on phi of FP values
Sanjay Patel [Wed, 25 Sep 2019 13:14:12 +0000 (13:14 +0000)]
[IR] allow fast-math-flags on phi of FP values

The changes here are based on the corresponding diffs for allowing FMF on 'select':
D61917

As discussed there, we want to have fast-math-flags be a property of an FP value
because the alternative (having them on things like fcmp) leads to logical
inconsistency such as:
https://bugs.llvm.org/show_bug.cgi?id=38086

The earlier patch for select made almost no practical difference because most
unoptimized conditional code begins life as a phi (based on what I see in clang).
Similarly, I don't expect this patch to do much on its own either because
SimplifyCFG promptly drops the flags when converting to select on a minimal
example like:
https://bugs.llvm.org/show_bug.cgi?id=39535

But once we have this plumbing in place, we should be able to wire up the FMF
propagation and start solving cases like that.

The change to RecurrenceDescriptor::AddReductionVar() is required to prevent a
regression in a LoopVectorize test. We are intersecting the FMF of any
FPMathOperator there, so if a phi is not properly annotated, new math
instructions may not be either. Once we fix the propagation in SimplifyCFG, it
may be safe to remove that hack.

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

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

5 years ago[docs][llvm-strings] Clarify "printable character" wording
James Henderson [Wed, 25 Sep 2019 13:09:17 +0000 (13:09 +0000)]
[docs][llvm-strings] Clarify "printable character" wording

The --bytes option uses the phrase "printable ASCII characters", but the
description section used simply "printable characters". To avoid any
confusion about locale impacts etc, this change adopts the former's
phrasing in both places. It also fixes a minor grammar issue in the
description.

Reviewed by: MaskRay

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

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

5 years ago[docs][llvm-strip] Update llvm-strip doc to better match llvm-objcopy's
James Henderson [Wed, 25 Sep 2019 13:09:12 +0000 (13:09 +0000)]
[docs][llvm-strip] Update llvm-strip doc to better match llvm-objcopy's

Main changes are mostly wording of some options, but this change also
fixes a switch reference so that a link is created and moves
--strip-sections into the ELF-specific area since it is only supported
for ELF currently.

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

5 years ago[AMDGPU][MC][DOC] Updated AMD GPU assembler description.
Dmitry Preobrazhensky [Wed, 25 Sep 2019 12:38:35 +0000 (12:38 +0000)]
[AMDGPU][MC][DOC] Updated AMD GPU assembler description.

Summary of changes:
- Updated to reflect recent changes in assembler;
- Minor bugfixing and improvements.

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

5 years ago[DAG] Pull out minimum shift value calc into a helper function. NFCI.
Simon Pilgrim [Wed, 25 Sep 2019 12:28:56 +0000 (12:28 +0000)]
[DAG] Pull out minimum shift value calc into a helper function. NFCI.

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

5 years ago[llvm-readobj] - Simplify stack-sizes.test test case.
George Rimar [Wed, 25 Sep 2019 12:18:45 +0000 (12:18 +0000)]
[llvm-readobj] - Simplify stack-sizes.test test case.

This is a follow-up for D67757,
which allows to describe .stack_sizes sections with a new
YAML syntax.

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

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

5 years ago[yaml2elf] - Support describing .stack_sizes sections using unique suffixes.
George Rimar [Wed, 25 Sep 2019 12:09:30 +0000 (12:09 +0000)]
[yaml2elf] - Support describing .stack_sizes sections using unique suffixes.

Currently we can't use unique suffixes in section names to describe
stack sizes sections. E.g. '.stack_sizes [1]' will be treated as a regular section.
This happens because we recognize stack sizes section by name and
do not yet drop the suffix before the check.

The patch fixes it.

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

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

5 years agogn build: (manually) merge r372843
Nico Weber [Wed, 25 Sep 2019 12:02:00 +0000 (12:02 +0000)]
gn build: (manually) merge r372843

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

5 years ago[yaml2obj] - Add a Size field for StackSizesSection.
George Rimar [Wed, 25 Sep 2019 11:40:11 +0000 (11:40 +0000)]
[yaml2obj] - Add a Size field for StackSizesSection.

It is a follow-up requested in the review comment
for D67757. Allows to use Content + Size or just Size
when describing .stack_sizes sections in YAML document

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

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

5 years agogn build: Merge r372841
GN Sync Bot [Wed, 25 Sep 2019 10:35:03 +0000 (10:35 +0000)]
gn build: Merge r372841

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

5 years ago[ARM] Ensure we do not attempt to create lsll #0
David Green [Wed, 25 Sep 2019 10:16:48 +0000 (10:16 +0000)]
[ARM] Ensure we do not attempt to create lsll #0

During legalisation we can end up with some pretty strange nodes, like shifts
of 0. We need to make sure we don't try to make long shifts of these, ending up
with invalid assembly instructions. A long shift with a zero immediate actually
encodes a shift by 32.

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

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

5 years ago[llvm-readobj] - Don't crash when dumping .stack_sizes and unable to find a relocatio...
George Rimar [Wed, 25 Sep 2019 10:14:50 +0000 (10:14 +0000)]
[llvm-readobj] - Don't crash when dumping .stack_sizes and unable to find a relocation resolver.

The crash might happen when we have either a broken or unsupported object
and trying to resolve relocations when dumping the .stack_sizes section.

For the test case I used a 32-bits ELF header and a 64-bit relocation.
In this case a null pointer is returned by the code instead of the relocation
resolver function and then we crash.

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

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

5 years agoAdd tracing in pickNodeFromQueue.
Jay Foad [Wed, 25 Sep 2019 08:45:41 +0000 (08:45 +0000)]
Add tracing in pickNodeFromQueue.

This matches GenericScheduler::pickNodeFromQueue, from which this
function was mostly cut and pasted.

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

5 years agoFix signature of overloaded operator delete.
Jay Foad [Wed, 25 Sep 2019 08:45:36 +0000 (08:45 +0000)]
Fix signature of overloaded operator delete.

This overload was left over from an operator new that was removed in
r123027. Fix it to match another operator new that was added in r248453.

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

5 years ago[AArch64] Convert neon_ushl and neon_sshl with positive constants to VSHL.
Florian Hahn [Wed, 25 Sep 2019 08:22:05 +0000 (08:22 +0000)]
[AArch64] Convert neon_ushl and neon_sshl with positive constants to VSHL.

I think we should be able to use shl instead of sshl and ushl for
positive constant shift values, unless I am missing something.

We already have the machinery in place to ensure we only replace
nodes, if the shift value is positive and <= the element width.

This is a generalization of an earlier patch rL372565.

Reviewers: t.p.northover, samparker, dmgreen, anemet

Reviewed By: anemet

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

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

5 years ago[ADT] Add StringMap::insert_or_assign
Fangrui Song [Wed, 25 Sep 2019 04:58:02 +0000 (04:58 +0000)]
[ADT] Add StringMap::insert_or_assign

Summary: Similar to std::unordered_map::insert_or_assign

Reviewers: alexshap, bkramer, dblaikie, lhames

Subscribers: jkorous, dexonsmith, kristina, llvm-commits

Tags: #llvm

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

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

5 years ago[AArch64][GlobalISel] Tweak legalization rule for G_BSWAP to handle widening s16.
Amara Emerson [Wed, 25 Sep 2019 04:52:42 +0000 (04:52 +0000)]
[AArch64][GlobalISel] Tweak legalization rule for G_BSWAP to handle widening s16.

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

5 years ago[NFC] Add { } to silence compiler warning [-Wmissing-braces].
Huihui Zhang [Wed, 25 Sep 2019 04:40:07 +0000 (04:40 +0000)]
[NFC] Add { } to silence compiler warning [-Wmissing-braces].

/local/mnt/workspace/huihuiz/llvm-comm-git-2/llvm-project/llvm/lib/Object/MachOObjectFile.cpp:2731:7: warning: suggest braces around initialization of subobject [-Wmissing-braces]
      "i386",   "x86_64", "x86_64h",  "armv4t",  "arm",    "armv5e",
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      {
1 warning generated.

/local/mnt/workspace/huihuiz/llvm-comm-git-2/llvm-project/llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp:355:46: warning: suggest braces around initialization of subobject [-Wmissing-braces]
    return addMappingFromTable<1>(MI, MRI, { 0 }, Table);
                                             ^
                                             {}
1 warning generated.

/local/mnt/workspace/huihuiz/llvm-comm-git-2/llvm-project/llvm/tools/llvm-objcopy/ELF/Object.cpp:400:57: warning: suggest braces around initialization of subobject [-Wmissing-braces]
static constexpr std::array<uint8_t, 4> ZlibGnuMagic = {'Z', 'L', 'I', 'B'};
                                                        ^~~~~~~~~~~~~~~~~~
                                                        {                 }
1 warning generated.

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

5 years ago[llvm-objcopy][test] Clean up -B tests
Fangrui Song [Wed, 25 Sep 2019 03:41:01 +0000 (03:41 +0000)]
[llvm-objcopy][test] Clean up -B tests

-B is ignored for GNU objcopy compatibility after D67215/r371914.

* Delete mentions of -B from input-output-target.test - we have enough -B tests.
* Merge binary-input-with-arch.test into binary-output-target.test.

Reviewed By: rupprecht

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

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

5 years ago[Powerpc][LoopPreIncPrep] NFC - refactor this pass for ds/dq form.
Chen Zheng [Wed, 25 Sep 2019 03:02:19 +0000 (03:02 +0000)]
[Powerpc][LoopPreIncPrep] NFC - refactor this pass for ds/dq form.

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

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

5 years ago[Docs] Moves Reference docs to new page
DeForest Richards [Wed, 25 Sep 2019 00:49:02 +0000 (00:49 +0000)]
[Docs] Moves Reference docs to new page

Moves Reference docs to new page. Also adds a table of contents to Getting Involved page.

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

5 years ago[WebAssembly][NFC] Remove duplicate SIMD instructions and predicates
Thomas Lively [Wed, 25 Sep 2019 00:15:59 +0000 (00:15 +0000)]
[WebAssembly][NFC] Remove duplicate SIMD instructions and predicates

Summary:
Instead of having different v128.load and v128.store instructions for
each MVT, just have one of each that is reused in all the
patterns. Also removes the HasSIMD128 predicate where accompanied by
HasUnimplementedSIMD128, since the latter implies the former.

Reviewers: aheejin, dschuff

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

Tags: #llvm

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

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

5 years agoUse double quotes for LDFLAGS in -DLLVM_BUILD_INSTRUMENTED_COVERAGE
Justin Bogner [Tue, 24 Sep 2019 23:56:22 +0000 (23:56 +0000)]
Use double quotes for LDFLAGS in -DLLVM_BUILD_INSTRUMENTED_COVERAGE

Mimics the changes in r372209 to handle the change of quotes in
r372226. Probably isn't sufficient for windows, but unbreaks the cmake
flag at least.

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

5 years ago[SCEV] Disable canonical expansion for non-affine addrecs.
Artur Pilipenko [Tue, 24 Sep 2019 23:21:07 +0000 (23:21 +0000)]
[SCEV] Disable canonical expansion for non-affine addrecs.

Reviewed By: apilipenko

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

Patch by Evgeniy Brevnov (ybrevnov@azul.com)

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

5 years ago[BPF] Generate array dimension size properly for zero-size elements
Yonghong Song [Tue, 24 Sep 2019 22:38:43 +0000 (22:38 +0000)]
[BPF] Generate array dimension size properly for zero-size elements

Currently, if an array element type size is 0, the number of
array elements will be set to 0, regardless of what user
specified. This implementation is done in the beginning where
BTF is mostly used to calculate the member offset.

For example,
  struct s {};
  struct s1 {
        int b;
        struct s a[2];
  };
  struct s1 s1;
The BTF will have struct "s1" member "a" with element count 0.

Now BTF types are used for compile-once and run-everywhere
relocations and we need more precise type representation
for type comparison. Andrii reported the issue as there
are differences between original structure and BTF-generated
structure.

This patch made the change to correctly assign "2"
as the number elements of member "a".
Some dead codes related to ElemSize compuation are also removed.

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

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

5 years agoAdding support for overriding LLVM_ENABLE_RUNTIMES for runtimes builds.
Puyan Lotfi [Tue, 24 Sep 2019 22:38:18 +0000 (22:38 +0000)]
Adding support for overriding LLVM_ENABLE_RUNTIMES for runtimes builds.

Second attempt: Now with ';' -> '|' replacement.

On some platforms, certain runtimes are not supported. For runtimes builds of
those platforms it would be nice if we could disable certain runtimes (ie
libunwind on Windows).

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

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

5 years ago[PGO][PGSO] ProfileSummary changes.
Hiroshi Yamauchi [Tue, 24 Sep 2019 22:17:51 +0000 (22:17 +0000)]
[PGO][PGSO] ProfileSummary changes.

(Split of off D67120)

ProfileSummary changes for profile guided size optimization.

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

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

5 years agoExtends the expansion of the LWZtoc pseduo op for AIX.
Sean Fertile [Tue, 24 Sep 2019 18:04:51 +0000 (18:04 +0000)]
Extends the expansion of the LWZtoc pseduo op for AIX.

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

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

5 years ago[GCRelocate] Add a peephole to canonicalize base pointer relocation
Philip Reames [Tue, 24 Sep 2019 17:24:16 +0000 (17:24 +0000)]
[GCRelocate] Add a peephole to canonicalize base pointer relocation

If we generate the gc.relocate, and then later prove two arguments to the statepoint are equivalent, we should canonicalize the gc.relocate to the form we would have produced if this had been known before rewriting.

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

5 years ago[X86] Add MMX MOVD/MOVQ stores to folding tables to support stack folding
Simon Pilgrim [Tue, 24 Sep 2019 16:15:32 +0000 (16:15 +0000)]
[X86] Add MMX MOVD/MOVQ stores to folding tables to support stack folding

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

5 years ago[InstCombine] (a+b) < a && (a+b) != 0 -> (0-b) < a iff a/b != 0 (PR43259)
Roman Lebedev [Tue, 24 Sep 2019 16:10:50 +0000 (16:10 +0000)]
[InstCombine] (a+b) < a && (a+b) != 0 -> (0-b) < a iff a/b != 0 (PR43259)

Summary:
This is again motivated by D67122 sanitizer check enhancement.
That patch seemingly worsens `-fsanitize=pointer-overflow`
overhead from 25% to 50%, which strongly implies missing folds.

For
```
#include <cassert>
char* test(char& base, signed long offset) {
  __builtin_assume(offset < 0);
  return &base + offset;
}
```
We produce

https://godbolt.org/z/r40U47

and again those two icmp's can be merged:
```
Name: 0
Pre: C != 0
  %adjusted = add i8 %base, C
  %not_null = icmp ne i8 %adjusted, 0
  %no_underflow = icmp ult i8 %adjusted, %base
  %r = and i1 %not_null, %no_underflow
=>
  %neg_offset = sub i8 0, C
  %r = icmp ugt i8 %base, %neg_offset
```
https://rise4fun.com/Alive/ALap
https://rise4fun.com/Alive/slnN

There are 3 other variants of this pattern,
i believe they all will go into InstSimplify.

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

Reviewers: spatel, xbolva00, nikic

Reviewed By: spatel

Subscribers: efriedma, hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[InstCombine] (a+b) <= a && (a+b) != 0 -> (0-b) < a (PR43259)
Roman Lebedev [Tue, 24 Sep 2019 16:10:38 +0000 (16:10 +0000)]
[InstCombine] (a+b) <= a && (a+b) != 0 -> (0-b) < a (PR43259)

Summary:
This is again motivated by D67122 sanitizer check enhancement.
That patch seemingly worsens `-fsanitize=pointer-overflow`
overhead from 25% to 50%, which strongly implies missing folds.

This pattern isn't exactly what we get there
(strict vs. non-strict predicate), but this pattern does not
require known-bits analysis, so it is best to handle it first.

```
Name: 0
  %adjusted = add i8 %base, %offset
  %not_null = icmp ne i8 %adjusted, 0
  %no_underflow = icmp ule i8 %adjusted, %base
  %r = and i1 %not_null, %no_underflow
=>
  %neg_offset = sub i8 0, %offset
  %r = icmp ugt i8 %base, %neg_offset
```
https://rise4fun.com/Alive/knp

There are 3 other variants of this pattern,
they all will go into InstSimplify:
https://rise4fun.com/Alive/bIDZ

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

Reviewers: spatel, xbolva00, nikic

Reviewed By: spatel

Subscribers: hiraditya, majnemer, vsk, llvm-commits

Tags: #llvm

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

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

5 years ago[X86] Add tests showing failure to stack fold MMX MOVD/MOVQ stores
Simon Pilgrim [Tue, 24 Sep 2019 15:40:09 +0000 (15:40 +0000)]
[X86] Add tests showing failure to stack fold MMX MOVD/MOVQ stores

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

5 years ago[TextAPI] Remove redundant checking causing warnings. NFC.
Michael Liao [Tue, 24 Sep 2019 14:52:13 +0000 (14:52 +0000)]
[TextAPI] Remove redundant checking causing warnings. NFC.

- Minor coding format.

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

5 years agoRegex: Make "match" and "sub" const member functions
Thomas Preud'homme [Tue, 24 Sep 2019 14:42:36 +0000 (14:42 +0000)]
Regex: Make "match" and "sub" const member functions

Summary:
The Regex "match" and "sub" member functions were previously not "const"
because they wrote to the "error" member variable. This commit removes
those assignments, and instead assumes that the validity of the regex
is already known after the initial compilation of the regular
expression. As a result, these member functions were possible to make
"const". This makes it easier to do things like pre-compile Regexes
up-front, and makes "match" and "sub" thread-safe. The error status is
now returned as an optional output, which also makes the API of "match"
and "sub" more consistent with each other.

Also, some uses of Regex that could be refactored to be const were made const.

Patch by Nicolas Guillemot

Reviewers: jankratochvil, thopre

Subscribers: llvm-commits

Tags: #llvm

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

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

5 years ago[yaml2obj/obj2yaml] - Add support for .stack_sizes sections.
George Rimar [Tue, 24 Sep 2019 14:22:37 +0000 (14:22 +0000)]
[yaml2obj/obj2yaml] - Add support for .stack_sizes sections.

.stack_sizes is a SHT_PROGBITS section that contains pairs of
<address (4/8 bytes), stack size (uleb128)>.

This patch teach tools to parse and dump it.

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

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

5 years ago[Compiler] Fix LLVM_NODISCARD for GCC
David Bolvansky [Tue, 24 Sep 2019 14:01:14 +0000 (14:01 +0000)]
[Compiler] Fix LLVM_NODISCARD for GCC

Summary:
This branch is currently dead since we don't use C++17.
 #if __cplusplus > 201402L && LLVM_HAS_CPP_ATTRIBUTE(nodiscard)
 #define LLVM_NODISCARD [[nodiscard]]

This branch is Clang-only.
 #elif LLVM_HAS_CPP_ATTRIBUTE(clang::warn_unused_result)
 #define LLVM_NODISCARD [[clang::warn_unused_result]]

While we could use gnu variant  [[gnu::warn_unused_result]], it is not ideal because it works only on functions.
/home/xbolva00/LLVM/llvm/include/llvm/ADT/ArrayRef.h:41:24: warning: â€˜warn_unused_result’ attribute only applies to function types [-Wattributes]

GCC (checked 5,6,7,8) seems to enable [[nodiscard]] even in C++14 mode and does not produce warnings that nodiscard is C++17 feature. but Clang does - but we do not reach it due the code above. So it affects only GCC and does what we want.

Reviewers: jfb, rsmith, echristo, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: MaskRay, dexonsmith

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

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

5 years agoAggressiveAntiDepBreaker - silence static analyzer null dereference warning. NFCI.
Simon Pilgrim [Tue, 24 Sep 2019 13:57:51 +0000 (13:57 +0000)]
AggressiveAntiDepBreaker - silence static analyzer null dereference warning. NFCI.

Assert that we've found the critical path.

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

5 years agoSafepointIRVerifier - silence static analyzer dyn_cast<Instruction> null dereference...
Simon Pilgrim [Tue, 24 Sep 2019 13:57:44 +0000 (13:57 +0000)]
SafepointIRVerifier - silence static analyzer dyn_cast<Instruction> null dereference warnings. NFCI.

The static analyzer is warning about a potential null dereference, but we should be able to use cast<Instruction> directly and if not assert will fire for us.

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

5 years ago[COFF] Silence static analyzer null dereference warning. NFCI.
Simon Pilgrim [Tue, 24 Sep 2019 13:57:38 +0000 (13:57 +0000)]
[COFF] Silence static analyzer null dereference warning. NFCI.

Assert that the COFFSymbolRef is correct.

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

5 years agoRevert r372333: [DAG][X86] Convert isNegatibleForFree/GetNegatedExpression to a targe...
Ilya Biryukov [Tue, 24 Sep 2019 13:48:02 +0000 (13:48 +0000)]
Revert r372333: [DAG][X86] Convert isNegatibleForFree/GetNegatedExpression to a target hook (PR42863)

Reason: this caused severe compile time regressions in JAX.
See email thread  of original revision on llvm-commits for details:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20190923/697042.html

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

5 years ago[docs][llvm-strip][llvm-objcopy] Improve wording and fix highlighting
James Henderson [Tue, 24 Sep 2019 13:41:39 +0000 (13:41 +0000)]
[docs][llvm-strip][llvm-objcopy] Improve wording and fix highlighting

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

5 years ago[docs][llvm-size] Fix typo
James Henderson [Tue, 24 Sep 2019 13:14:22 +0000 (13:14 +0000)]
[docs][llvm-size] Fix typo

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

5 years ago[Orc] Silence static analyzer dyn_cast<ConstantInt> null dereference warning. NFCI.
Simon Pilgrim [Tue, 24 Sep 2019 12:43:55 +0000 (12:43 +0000)]
[Orc] Silence static analyzer dyn_cast<ConstantInt> null dereference warning. NFCI.

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

5 years ago[llvm-objcopy] Fix a warningon unused variable. NFC.
Michael Liao [Tue, 24 Sep 2019 12:43:44 +0000 (12:43 +0000)]
[llvm-objcopy] Fix a warningon unused variable. NFC.

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

5 years agoConstantFold - silence static analyzer dyn_cast<> null dereference warning. NFCI.
Simon Pilgrim [Tue, 24 Sep 2019 12:30:13 +0000 (12:30 +0000)]
ConstantFold - silence static analyzer dyn_cast<> null dereference warning. NFCI.

Early out if the vector element is not Constant.

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

5 years agoFix cppcheck "reduce variable scope" warning. NFCI.
Simon Pilgrim [Tue, 24 Sep 2019 12:30:07 +0000 (12:30 +0000)]
Fix cppcheck "reduce variable scope" warning. NFCI.

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

5 years ago[IR] IntrinsicInst - silence static analyzer dyn_cast<> null dereference warnings...
Simon Pilgrim [Tue, 24 Sep 2019 11:40:45 +0000 (11:40 +0000)]
[IR] IntrinsicInst - silence static analyzer dyn_cast<> null dereference warnings. NFCI.

The static analyzer is warning about a potential null dereference, but we should be able to use cast<> directly and if not assert will fire for us.

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

5 years agoLoopVectorize - silence static analyzer dyn_cast<CmpInst> null dereference warning...
Simon Pilgrim [Tue, 24 Sep 2019 11:27:38 +0000 (11:27 +0000)]
LoopVectorize - silence static analyzer dyn_cast<CmpInst> null dereference warning. NFCI.

The static analyzer is warning about a potential null dereference, but we should be able to use cast<CmpInst> directly and if not assert will fire for us.

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

5 years ago[tblgen] Disable Leak detection for ASan/GCC and LSan/LLVM
Kamil Rytarowski [Tue, 24 Sep 2019 11:22:34 +0000 (11:22 +0000)]
[tblgen] Disable Leak detection for ASan/GCC and LSan/LLVM

Summary: Add support for sanitizing TableGen.cpp with ASan/GCC and LSan/LLVM.

Reviewers: fjricci, kcc, aaron.ballman, mgorny

Reviewed By: fjricci

Subscribers: jakubjelinek, llvm-commits, #llvm

Tags: #llvm

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

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

5 years ago[SimplifyCFG] FoldTwoEntryPHINode - silence static analyzer null dereference warning...
Simon Pilgrim [Tue, 24 Sep 2019 11:17:20 +0000 (11:17 +0000)]
[SimplifyCFG] FoldTwoEntryPHINode - silence static analyzer null dereference warning. NFCI.

Assert that we've found the DomBlock.

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

5 years agoSimplifyCFG - silence static analyzer dyn_cast<LandingPadInst> null dereference warni...
Simon Pilgrim [Tue, 24 Sep 2019 11:17:13 +0000 (11:17 +0000)]
SimplifyCFG - silence static analyzer dyn_cast<LandingPadInst> null dereference warning. NFCI.

The static analyzer is warning about a potential null dereference, but we should be able to use cast<LandingPadInst> directly and if not assert will fire for us.

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

5 years agoSimplifyCFG - silence static analyzer dyn_cast<Instruction> null dereference warning...
Simon Pilgrim [Tue, 24 Sep 2019 11:17:06 +0000 (11:17 +0000)]
SimplifyCFG - silence static analyzer dyn_cast<Instruction> null dereference warning. NFCI.

The static analyzer is warning about a potential null dereference, but we should be able to use cast<Instruction> directly and if not assert will fire for us.

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