]> granicus.if.org Git - llvm/log
llvm
5 years ago[CodeGen] Handle SMULFIXSAT with scale zero in TargetLowering::expandFixedPointMul
Bjorn Pettersson [Sat, 7 Sep 2019 12:16:23 +0000 (12:16 +0000)]
[CodeGen] Handle SMULFIXSAT with scale zero in TargetLowering::expandFixedPointMul

Summary:
Normally TargetLowering::expandFixedPointMul would handle
SMULFIXSAT with scale zero by using an SMULO to compute the
product and determine if saturation is needed (if overflow
happened). But if SMULO isn't custom/legal it falls through
and uses the same technique, using MULHS/SMUL_LOHI, as used
for non-zero scales.

Problem was that when checking for overflow (handling saturation)
when not using MULO we did not expect to find a zero scale. So
we ended up in an assertion when doing
  APInt::getLowBitsSet(VTSize, Scale - 1)

This patch fixes the problem by adding a new special case for
how saturation is computed when scale is zero.

Reviewers: RKSimon, bevinh, leonardchan, spatel

Reviewed By: RKSimon

Subscribers: wuzish, nemanjai, hiraditya, MaskRay, jsji, llvm-commits

Tags: #llvm

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

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

5 years ago[Intrinsic] Add the llvm.umul.fix.sat intrinsic
Bjorn Pettersson [Sat, 7 Sep 2019 12:16:14 +0000 (12:16 +0000)]
[Intrinsic] Add the llvm.umul.fix.sat intrinsic

Summary:
Add an intrinsic that takes 2 unsigned integers with
the scale of them provided as the third argument and
performs fixed point multiplication on them. The
result is saturated and clamped between the largest and
smallest representable values of the first 2 operands.

This is a part of implementing fixed point arithmetic
in clang where some of the more complex operations
will be implemented as intrinsics.

Patch by: leonardchan, bjope

Reviewers: RKSimon, craig.topper, bevinh, leonardchan, lebedev.ri, spatel

Reviewed By: leonardchan

Subscribers: ychen, wuzish, nemanjai, MaskRay, jsji, jdoerfert, Ka-Ka, hiraditya, rjmccall, llvm-commits

Tags: #llvm

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

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

5 years ago[X86] Fix pshuflw formation from repeated shuffle mask (PR43230)
Nikita Popov [Sat, 7 Sep 2019 12:13:44 +0000 (12:13 +0000)]
[X86] Fix pshuflw formation from repeated shuffle mask (PR43230)

Fix for https://bugs.llvm.org/show_bug.cgi?id=43230.

When creating PSHUFLW from a repeated shuffle mask, we have to apply
the checks to the repeated mask, not the original one. For the test
case from PR43230 the inspected part of the original mask is all undef.

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

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

5 years ago[LVI] Look through extractvalue of insertvalue
Nikita Popov [Sat, 7 Sep 2019 12:03:59 +0000 (12:03 +0000)]
[LVI] Look through extractvalue of insertvalue

This addresses the issue mentioned on D19867. When we simplify
with.overflow instructions in CVP, we leave behind extractvalue
of insertvalue sequences that LVI no longer understands. This
means that we can not simplify any instructions based on the
with.overflow anymore (until some over pass like InstCombine
cleans them up).

This patch extends LVI extractvalue handling by calling
SimplifyExtractValueInst (which doesn't do anything more than
constant folding + looking through insertvalue) and using the block
value of the simplification.

A possible alternative would be to do something similar to
SimplifyIndVars, where we instead directly try to replace
extractvalue users of the with.overflow. This would need some
additional structural changes to CVP, as it's currently not legal
to remove anything but the current instruction -- we'd have to
introduce a worklist with instructions scheduled for deletion or similar.

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

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

5 years ago[X86] Add test for PR43230; NFC
Nikita Popov [Sat, 7 Sep 2019 12:03:48 +0000 (12:03 +0000)]
[X86] Add test for PR43230; NFC

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

5 years ago[DwarfExpression] Disallow some rewrites to avoid undefined behavior
Bjorn Pettersson [Sat, 7 Sep 2019 11:40:10 +0000 (11:40 +0000)]
[DwarfExpression] Disallow some rewrites to avoid undefined behavior

Summary:
The value operand in DW_OP_plus_uconst/DW_OP_constu value can be
large (it uses uint64_t as representation internally in LLVM).
This means that in the uint64_t to int conversions, previously done
by DwarfExpression::addMachineRegExpression, could lose information.
Also, the negation done in "-Offset" was undefined behavior in case
Offset was exactly INT_MIN.

To avoid the above problems, we now avoid transformation like
 [Reg, DW_OP_plus_uconst, Offset] --> [DW_OP_breg, Offset]
and
 [Reg, DW_OP_constu, Offset, DW_OP_plus]  --> [DW_OP_breg, Offset]
when Offset > INT_MAX.

And we avoid to transform
 [Reg, DW_OP_constu, Offset, DW_OP_minus] --> [DW_OP_breg,-Offset]
when Offset > INT_MAX+1.

The patch also adjusts DwarfCompileUnit::constructVariableDIEImpl
to make sure that "DW_OP_constu, Offset, DW_OP_minus" is used
instead of "DW_OP_plus_uconst, Offset" when creating DIExpressions
with negative frame index offsets.

Notice that this might just be the tip of the iceberg. There
are lots of fishy handling related to these constants. I think both
DIExpression::appendOffset and DIExpression::extractIfOffset may
trigger undefined behavior for certain values.

Reviewers: sdesmalen, rnk, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: jholewinski, aprantl, hiraditya, ychen, uabelho, llvm-commits

Tags: #debug-info, #llvm

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

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

5 years ago[DebugInfo] Pre-commit of test case for DW_OP_breg/DW_OP_fbreg folds
Bjorn Pettersson [Sat, 7 Sep 2019 11:39:57 +0000 (11:39 +0000)]
[DebugInfo] Pre-commit of test case for DW_OP_breg/DW_OP_fbreg folds

This currently triggers undefined behavior if executed with an
ubsan build. It is just a precommit of the test case to show that
we got a problem.

Fix is proposed in https://reviews.llvm.org/D67263 and plan is to
commit the fix directly after this patch.

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

5 years agoFix MSVC "32-bit shift implicitly converted to 64 bits" warnings. NFCI.
Simon Pilgrim [Sat, 7 Sep 2019 11:04:04 +0000 (11:04 +0000)]
Fix MSVC "32-bit shift implicitly converted to 64 bits" warnings. NFCI.

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

5 years ago[SimplifyCFG][NFC] Make merge-cond-stores-cost.ll X86-specific, and rewrite it
Roman Lebedev [Sat, 7 Sep 2019 10:55:04 +0000 (10:55 +0000)]
[SimplifyCFG][NFC] Make merge-cond-stores-cost.ll X86-specific, and rewrite it

We clearly perform store-merging, even though div is really costly.

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

5 years ago[Attributor] Make unimplemented method pure virtual.
Benjamin Kramer [Sat, 7 Sep 2019 10:27:13 +0000 (10:27 +0000)]
[Attributor] Make unimplemented method pure virtual.

Otherwise the compiler mistakes it for a vtable anchor.

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

5 years ago[SimplifyCFG][NFC] Show that we don't consider the cost when merging cond stores
Roman Lebedev [Sat, 7 Sep 2019 09:25:26 +0000 (09:25 +0000)]
[SimplifyCFG][NFC] Show that we don't consider the cost when merging cond stores

We count instruction count in each BB's separately, not their cost.

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

5 years ago[SimplifyCFG][NFC] Regenerate merge-cond-stores* tests
Roman Lebedev [Sat, 7 Sep 2019 09:25:18 +0000 (09:25 +0000)]
[SimplifyCFG][NFC] Regenerate merge-cond-stores* tests

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

5 years ago[SimplifyCFG] SpeculativelyExecuteBB(): It's SpeculatedInstructions, not SpeculationCost
Roman Lebedev [Sat, 7 Sep 2019 09:06:06 +0000 (09:06 +0000)]
[SimplifyCFG] SpeculativelyExecuteBB(): It's SpeculatedInstructions, not SpeculationCost

It counts the number of instructions we are ok speculating
(at most 1 there), not their cost, so rename accordingly.

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

5 years agoReplicate the change "[Alignment][NFC] Use Align with TargetLowering::setMinFunctionA...
Sylvestre Ledru [Sat, 7 Sep 2019 08:38:46 +0000 (08:38 +0000)]
Replicate the change "[Alignment][NFC] Use Align with TargetLowering::setMinFunctionAlignment"
on AVR to avoid a breakage.
See r371200 / https://reviews.llvm.org/D67229

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

5 years ago[Attributor] ValueSimplify Abstract Attribute
Hideto Ueno [Sat, 7 Sep 2019 07:03:05 +0000 (07:03 +0000)]
[Attributor] ValueSimplify Abstract Attribute

Summary:
This patch introduces initial `AAValueSimplify` which simplifies a value in a context.

example
- (for function returned) If all the return values are the same and constant, then we can replace callsite returned with the constant.
- If an internal function takes the same value(constant) as an argument in the callsite, then we can replace the argument with that constant.

Reviewers: jdoerfert, sstefan1

Reviewed By: jdoerfert

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[git-llvm] Do not reinvent `@{upstream}`
David Zarzycki [Sat, 7 Sep 2019 06:44:52 +0000 (06:44 +0000)]
[git-llvm] Do not reinvent `@{upstream}`

Make `git-llvm` more robust when used with a nontrivial repository.

https://reviews.llvm.org/D67262

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

5 years agoRevert [CodeGen] Fix typos to run tests. NFC.
Xing GUO [Sat, 7 Sep 2019 05:14:47 +0000 (05:14 +0000)]
Revert [CodeGen] Fix typos to run tests. NFC.

This reverts r371286 (git commit b38105bbd0f7dfef424a4f096aa6a6b7b467fe99)

r371286 caused build bots' failure. I'll check it.

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

5 years ago[CodeGen] Fix typos to run tests. NFC.
Xing GUO [Sat, 7 Sep 2019 04:57:53 +0000 (04:57 +0000)]
[CodeGen] Fix typos to run tests. NFC.

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

5 years agoChange TargetLibraryInfo analysis passes to always require Function
Teresa Johnson [Sat, 7 Sep 2019 03:09:36 +0000 (03:09 +0000)]
Change TargetLibraryInfo analysis passes to always require Function

Summary:
This is the first change to enable the TLI to be built per-function so
that -fno-builtin* handling can be migrated to use function attributes.
See discussion on D61634 for background. This is an enabler for fixing
handling of these options for LTO, for example.

This change should not affect behavior, as the provided function is not
yet used to build a specifically per-function TLI, but rather enables
that migration.

Most of the changes were very mechanical, e.g. passing a Function to the
legacy analysis pass's getTLI interface, or in Module level cases,
adding a callback. This is similar to the way the per-function TTI
analysis works.

There was one place where we were looking for builtins but not in the
context of a specific function. See FindCXAAtExit in
lib/Transforms/IPO/GlobalOpt.cpp. I'm somewhat concerned my workaround
could provide the wrong behavior in some corner cases. Suggestions
welcome.

Reviewers: chandlerc, hfinkel

Subscribers: arsenm, dschuff, jvesely, nhaehnle, mehdi_amini, javed.absar, sbc100, jgravelle-google, eraman, aheejin, steven_wu, george.burgess.iv, dexonsmith, jfb, asbirlea, gchatelet, llvm-commits

Tags: #llvm

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

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

5 years ago[X86] Add tests for fp128 frem, sqrt, sin, and cos.
Craig Topper [Sat, 7 Sep 2019 01:39:21 +0000 (01:39 +0000)]
[X86] Add tests for fp128 frem, sqrt, sin, and cos.

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

5 years ago[X86] Autogenerate fp128-libcalls.ll
Craig Topper [Sat, 7 Sep 2019 01:39:12 +0000 (01:39 +0000)]
[X86] Autogenerate fp128-libcalls.ll

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

5 years ago[llvm-objcopy] Rename SHOffset (e_shoff) field to SHOff. NFC
Fangrui Song [Sat, 7 Sep 2019 01:38:56 +0000 (01:38 +0000)]
[llvm-objcopy] Rename SHOffset (e_shoff) field to SHOff. NFC

Similar to D67254.

`struct Elf*_Shdr` has a field `sh_offset`. Rename SHOffset to SHOff to
avoid confusion.

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

5 years agoSynchronize LLVM's copy of libc++abi's demangler with the libc++abi
Richard Smith [Sat, 7 Sep 2019 00:11:53 +0000 (00:11 +0000)]
Synchronize LLVM's copy of libc++abi's demangler with the libc++abi
version after r371273.

Also fix a minor issue in r371273 that only surfaced after template
instantiation from LLVM's use of the demangler.

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

5 years ago[AArch64][GlobalISel] Enable the localizer for optimized builds.
Amara Emerson [Fri, 6 Sep 2019 22:27:09 +0000 (22:27 +0000)]
[AArch64][GlobalISel] Enable the localizer for optimized builds.

Despite the fact that the localizer's original motivation was to fix horrendous
constant spilling at -O0, shortening live ranges still has net benefits even
with optimizations enabled.

On an -Os build of CTMark, doing this improves code size by 0.5% geomean.

There are a few regressions, bullet increasing in size by 0.5%. One example from
bullet where code size increased slightly was due to GlobalISel actually now
generating the same code as SelectionDAG. So we actually have an opportunity
in future to implement better heuristics for localization and therefore be
*better* than SDAG in some cases. In relation to other optimizations though that
one is relatively minor.

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

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

5 years ago[InstCombine] Refactor substitution of instruction in the parent BB (NFC)
Evandro Menezes [Fri, 6 Sep 2019 22:07:11 +0000 (22:07 +0000)]
[InstCombine] Refactor substitution of instruction in the parent BB (NFC)

Add the new method `LibCallSimplifier::substituteInParent()` that calls
`LibCallSimplifier::replaceAllUsesWith()' and
`LibCallSimplifier::eraseFromParent()` back to back, simplifying the
resulting code.

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

5 years ago[ORC][RPC] Join server thread before checking condition in unit test.
Lang Hames [Fri, 6 Sep 2019 21:55:43 +0000 (21:55 +0000)]
[ORC][RPC] Join server thread before checking condition in unit test.

Otherwise we have a race on the sent-messages count.

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

5 years ago[IR] CallBrInst: scan+update arg list when indirect dest list changes
Nick Desaulniers [Fri, 6 Sep 2019 21:50:11 +0000 (21:50 +0000)]
[IR] CallBrInst: scan+update arg list when indirect dest list changes

Summary:
There's an unspoken invariant of callbr that the list of BlockAddress
Constants in the "function args" list match the BasicBlocks in the
"other labels" list. (This invariant is being added to the LangRef in
https://reviews.llvm.org/D67196).

When modifying the any of the indirect destinations of a callbr
instruction (possible jump targets), we need to update the function
arguments if the argument is a BlockAddress whose BasicBlock refers to
the indirect destination BasicBlock being replaced.  Otherwise, many
transforms that modify successors will end up violating that invariant.
A recent change to the arm64 Linux kernel exposed this bug, which
prevents the kernel from booting.

I considered maintaining a mapping from indirect destination BasicBlock
to argument operand BlockAddress, but this ends up being a one to
potentially many (though usually one) mapping.  Also, the list of
arguments to a function (or more typically inline assembly) ends up
being less than 10.  The implementation is significantly simpler to just
rescan the full list of arguments. Because of the one to potentially
many relationship, the full arg list must be scanned (we can't stop at
the first instance).

Thanks to the following folks that reported the issue and helped debug
it:
* Nathan Chancellor
* Will Deacon
* Andrew Murray
* Craig Topper

Link: https://bugs.llvm.org/show_bug.cgi?id=43222
Link: https://github.com/ClangBuiltLinux/linux/issues/649
Link: https://lists.infradead.org/pipermail/linux-arm-kernel/2019-September/678330.html
Reviewers: craig.topper, chandlerc

Reviewed By: craig.topper

Subscribers: void, javed.absar, kristof.beyls, hiraditya, llvm-commits, nathanchance, srhines

Tags: #llvm

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

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

5 years ago[X86] Add a AVX512VBMI command line to min-legal-vector-width.ll. Always enable fast...
Craig Topper [Fri, 6 Sep 2019 21:49:01 +0000 (21:49 +0000)]
[X86] Add a AVX512VBMI command line to min-legal-vector-width.ll. Always enable fast-variable-shuffle

Trying to minimize the features we need to manipulate when this
is updated for D67259.

The VBMI is interesting because it enables some improved combining
for truncates.

I enabled fast-variable-shuffle because all the CPUs we're going
to add implicitly enable it. So they can share check lines.

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

5 years ago[X86] Replace -mcpu with -mattr on some tests.
Craig Topper [Fri, 6 Sep 2019 21:48:44 +0000 (21:48 +0000)]
[X86] Replace -mcpu with -mattr on some tests.

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

5 years ago[ORC] Add a missing #include atomic.
Lang Hames [Fri, 6 Sep 2019 20:50:00 +0000 (20:50 +0000)]
[ORC] Add a missing #include atomic.

Hopefully this will fix the bot build failures from r371245.

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

5 years agoGlobalISel: Add G_FMAD instruction
Matt Arsenault [Fri, 6 Sep 2019 20:49:10 +0000 (20:49 +0000)]
GlobalISel: Add G_FMAD instruction

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

5 years agoGlobalISel: Support physical register inputs in patterns
Matt Arsenault [Fri, 6 Sep 2019 20:32:37 +0000 (20:32 +0000)]
GlobalISel: Support physical register inputs in patterns

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

5 years agoRemove dead .seh_stackalloc parsing method in X86AsmParser
Reid Kleckner [Fri, 6 Sep 2019 20:12:44 +0000 (20:12 +0000)]
Remove dead .seh_stackalloc parsing method in X86AsmParser

The shared COFF asm parser code handles this directive, since it is
shared with AArch64. Spotted by Alexandre Ganea in review.

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

5 years agoAMDGPU: Fix typo
Matt Arsenault [Fri, 6 Sep 2019 20:00:22 +0000 (20:00 +0000)]
AMDGPU: Fix typo

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

5 years ago[llvm-ifs] Improving detection of PlatformKind from triple for TBD generation.
Puyan Lotfi [Fri, 6 Sep 2019 19:59:59 +0000 (19:59 +0000)]
[llvm-ifs] Improving detection of PlatformKind from triple for TBD generation.

It was pointed out that I had hard-coded PlatformKind. This is rectifying that.

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

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

5 years ago[PowerPC][XCOFF] Remove basic test. [NFC]
Sean Fertile [Fri, 6 Sep 2019 19:55:44 +0000 (19:55 +0000)]
[PowerPC][XCOFF] Remove basic test. [NFC]

Test verified that we could compile an empty module and produce an XCOFF
object file. Newer tests superssed this coverage, its safe to remove.

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

5 years ago[ConstantFolding] Add new test cases for transcendentals (NFC)
Evandro Menezes [Fri, 6 Sep 2019 19:41:49 +0000 (19:41 +0000)]
[ConstantFolding] Add new test cases for transcendentals (NFC)

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

5 years ago[ORC] Make sure RPC channel-send is called in blocking calls and responses.
Lang Hames [Fri, 6 Sep 2019 19:21:59 +0000 (19:21 +0000)]
[ORC] Make sure RPC channel-send is called in blocking calls and responses.

ORC-RPC batches calls by default, and the channel's send method must be called
to transfer any buffered calls to the remote. The call to send was missing on
responses and blocking calls in the SingleThreadedRPCEndpoint. This patch adds
the necessary calls and modifies the RPC unit test to check for them.

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

5 years ago[llvm-jitlink] Add optional slab allocator for testing locality optimizations.
Lang Hames [Fri, 6 Sep 2019 19:21:55 +0000 (19:21 +0000)]
[llvm-jitlink] Add optional slab allocator for testing locality optimizations.

The llvm-jitlink utility now accepts a '-slab-allocate <size>' option. If given,
llvm-jitlink will use a slab-based memory manager rather than the default
InProcessMemoryManager. Using a slab allocator will allow reliable testing of
future locality based optimizations (e.g. PLT and GOT elimination) in JITLink.

The <size> argument is a number, optionally followed by a units specifier (Kb,
Mb, or Gb). If the units are not given then the number is assumed to be in Kb.

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

5 years ago[X86] Use MOVSX by default instead of CBW to extend i8 to AX for i8 sdivrem.
Craig Topper [Fri, 6 Sep 2019 19:17:02 +0000 (19:17 +0000)]
[X86] Use MOVSX by default instead of CBW to extend i8 to AX for i8 sdivrem.

We can use a MOVSX16 here then rely on FixupBWInst to change to
MOVSX32 if the upper bits are dead. With a special case to
not promote if it could be turned into CBW.

Then we can rely on X86MCInstLower to turn the MOVSX into CBW
very late if register allocation worked out.

Using MOVSX gives an opportunity to use the MOVSX as a both a
copy and a sign extend since the input and output register aren't
tied together.

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

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

5 years ago[X86] Use MOVZX16rr8/MOVZXrm8 when extending input for i8 udivrem.
Craig Topper [Fri, 6 Sep 2019 19:15:04 +0000 (19:15 +0000)]
[X86] Use MOVZX16rr8/MOVZXrm8 when extending input for i8 udivrem.

We can rely on X86FixupBWInsts to turn these into MOVZX32. This
simplifies a follow up commit to use MOVSX for i8 sdivrem with
a late optimization to use CBW when register allocation works out.

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

5 years ago[X86] Teach FixupBWInsts to turn MOVSX16rr8/MOVZX16rr8/MOVSX16rm8/MOVZX16rm8 into...
Craig Topper [Fri, 6 Sep 2019 19:14:49 +0000 (19:14 +0000)]
[X86] Teach FixupBWInsts to turn MOVSX16rr8/MOVZX16rr8/MOVSX16rm8/MOVZX16rm8 into their 32-bit dest equivalents when the upper part of the register is dead.

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

5 years ago[PowerPC][XCOFF] Verify symbol table in xcoff object files. [NFC]
Sean Fertile [Fri, 6 Sep 2019 18:56:14 +0000 (18:56 +0000)]
[PowerPC][XCOFF] Verify symbol table in xcoff object files. [NFC]

Extend the common/local-common testing for object files to also verify the
symbol table now that the needed functionality has landed in llvm-readobj.

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

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

5 years ago[ConstantFolding] Refactor functions not available before C99 (NFC)
Evandro Menezes [Fri, 6 Sep 2019 18:24:21 +0000 (18:24 +0000)]
[ConstantFolding] Refactor functions not available before C99 (NFC)

Note the cases when calling a function at compile time may fail if the host
does not support the C99 run time library.

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

5 years ago[FPEnv] Teach the IRBuilder about constrained FPToSI and FPToUI.
Kevin P. Neal [Fri, 6 Sep 2019 18:04:34 +0000 (18:04 +0000)]
[FPEnv] Teach the IRBuilder about constrained FPToSI and FPToUI.

The IRBuilder doesn't know that the two floating point to integer instructions
have constrained equivalents. This patch adds the support by building on
the strict FP mode now present in the IRBuilder.

Reviewed by: John McCall
Approved by: John McCall
Differential Revision: https://reviews.llvm.org/D67291

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

5 years ago[Remarks] Add support for internalizing a remark in a string table
Francis Visoiu Mistrih [Fri, 6 Sep 2019 17:22:51 +0000 (17:22 +0000)]
[Remarks] Add support for internalizing a remark in a string table

In order to keep remarks around, we need to make them tied to a string
table.

Users then can delete the parser and rely on the string table to keep
the memory of the strings alive and deduplicated.

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

5 years ago[ARM] Add patterns for VSUB with q and r registers
Oliver Cruickshank [Fri, 6 Sep 2019 17:02:42 +0000 (17:02 +0000)]
[ARM] Add patterns for VSUB with q and r registers

Added patterns for VSUB to support q and r registers, which reduces
pressure on q registers.

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

5 years ago[ARM] Add patterns for VADD with q and r registers
Oliver Cruickshank [Fri, 6 Sep 2019 17:02:35 +0000 (17:02 +0000)]
[ARM] Add patterns for VADD with q and r registers

Added support for VADD to use q and r registers, which reduces pressure
on q registers.

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

5 years ago[ARM] Add patterns for VMUL with q and r registers
Oliver Cruickshank [Fri, 6 Sep 2019 17:02:21 +0000 (17:02 +0000)]
[ARM] Add patterns for VMUL with q and r registers

Added support for VMUL to use an r register, this reduces pressure on
the q registers.

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

5 years ago[ConstantFolding] Refactor function match for better speed (NFC)
Evandro Menezes [Fri, 6 Sep 2019 16:49:49 +0000 (16:49 +0000)]
[ConstantFolding] Refactor function match for better speed (NFC)

Use an `enum` instead of string comparison to match the candidate function.

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

5 years ago[AArch64][GlobalISel] Always fall back on tail calls with -tailcallopt
Jessica Paquette [Fri, 6 Sep 2019 16:49:13 +0000 (16:49 +0000)]
[AArch64][GlobalISel] Always fall back on tail calls with -tailcallopt

-tailcallopt requires that we perform different stack adjustments than with
sibling calls. For example, the `@caller_to0_from8` function in
test/CodeGen/AArch64/tail-call.ll requires that we adjust SP. Without
-tailcallopt, this adjustment does not happen. With it, however, it is expected.

So, to ensure that adding sibling call support doesn't break -tailcallopt,
make CallLowering always fall back on possible tail calls when -tailcallopt
is passed in.

Update test/CodeGen/AArch64/tail-call.ll with a GlobalISel line to make sure
that we don't differ from the SDAG implementation at any point.

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

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

5 years ago[InstCombine] pow(x, +/- 0.0) -> 1.0
JF Bastien [Fri, 6 Sep 2019 16:26:59 +0000 (16:26 +0000)]
[InstCombine] pow(x, +/- 0.0) -> 1.0

Summary:
This isn't an important optimization at all... We're already doing:
  pow(x, 0.0) -> 1.0
My patch merely teaches instcombine that -0.0 does the same.

However, doing this fixes an AMAZING bug! Compile this program:

  extern "C" double pow(double, double);
  double boom(double base) {
    return pow(base, -0.0);
  }

With:
  clang++ ~/Desktop/fast-math.cpp -ffast-math -O2 -S

And clang will crash with a signal. Wow, fast math is so fast it ICEs the
compiler! Arguably, the generated math is infinitely fast.

What's actually happening is that we recurse infinitely in getPow. In debug we
hit its assertion:
  assert(Exp != 0 && "Incorrect exponent 0 not handled");

We avoid this entire mess if we instead recognize that an exponent of positive
and negative zero yield 1.0.

A separate commit, r371221, fixed the same problem. This only contains the added
tests.

<rdar://problem/54598300>

Reviewers: scanon

Subscribers: hiraditya, jkorous, dexonsmith, ributzka, llvm-commits

Tags: #llvm

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

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

5 years ago[SimplifyLibCalls] handle pow(x,-0.0) before it can assert (PR43233)
Sanjay Patel [Fri, 6 Sep 2019 16:10:18 +0000 (16:10 +0000)]
[SimplifyLibCalls] handle pow(x,-0.0) before it can assert (PR43233)

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

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

5 years ago[ARM] Sink add/mul(shufflevector(insertelement())) for MVE instruction selection
Sam Tebbs [Fri, 6 Sep 2019 16:01:32 +0000 (16:01 +0000)]
[ARM] Sink add/mul(shufflevector(insertelement())) for MVE instruction selection

This patch sinks add/mul(shufflevector(insertelement())) into the basic block in which they are used so that they can then be selected together.

This is useful for various MVE instructions, such as vmla and others that take R registers.

Loop tests have been added to the vmla test file to make sure vmlas are generated in loops.

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

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

5 years ago[AMDGPU] Enable constant offset promotion to immediate operand for VMEM stores
Valery Pykhtin [Fri, 6 Sep 2019 15:33:53 +0000 (15:33 +0000)]
[AMDGPU] Enable constant offset promotion to immediate operand for VMEM stores

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

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

5 years ago[Alignment][NFC] Use Align with TargetLowering::setPrefFunctionAlignment
Guillaume Chatelet [Fri, 6 Sep 2019 15:03:49 +0000 (15:03 +0000)]
[Alignment][NFC] Use Align with TargetLowering::setPrefFunctionAlignment

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: nemanjai, javed.absar, hiraditya, kbarton, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, jsji, s.egerton, pzheng, ychen, llvm-commits

Tags: #llvm

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

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

5 years ago[Object] remove struct constructor, NFC
Cyndy Ishida [Fri, 6 Sep 2019 15:02:22 +0000 (15:02 +0000)]
[Object] remove struct constructor, NFC

Summary: make POD struct by removing ctors

Reviewers: avl, dblaikie

Reviewed By: dblaikie

Subscribers: ributzka, llvm-commits

Tags: #llvm

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

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

5 years ago[Alignment][NFC] Use Align with TargetLowering::setPrefLoopAlignment
Guillaume Chatelet [Fri, 6 Sep 2019 14:51:15 +0000 (14:51 +0000)]
[Alignment][NFC] Use Align with TargetLowering::setPrefLoopAlignment

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: nemanjai, hiraditya, kbarton, MaskRay, jsji, ychen, llvm-commits

Tags: #llvm

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

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

5 years ago[Alignment] fix dubious min function alignment
Guillaume Chatelet [Fri, 6 Sep 2019 13:54:09 +0000 (13:54 +0000)]
[Alignment] fix dubious min function alignment

Summary:
This was discovered while introducing the llvm::Align type.
The original setMinFunctionAlignment used to take alignment as log2, looking at the comment it seems like instructions are to be 2-bytes aligned and not 4-bytes aligned.

Reviewers: uweigand

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[llvm-readelf] - Print unknown st_other value if present in GNU output.
George Rimar [Fri, 6 Sep 2019 13:05:34 +0000 (13:05 +0000)]
[llvm-readelf] - Print unknown st_other value if present in GNU output.

This is a fix for https://bugs.llvm.org/show_bug.cgi?id=40785.

llvm-readelf does not print the st_value of the symbol when
st_value has any non-visibility bits set.

This patch:

* Aligns "Ndx" row for the default and a new cases.
(it was 1 space character off for the case when "PROTECTED" visibility was printed)

* Prints "[<other>: 0x??]" for symbols which has an additional st_other bits set.
In compare with GNU, this logic is a bit simpler and seems to be more consistent.

For MIPS GNU can print named flags, though can't print a mix of them:
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 00000000 0 NOTYPE GLOBAL DEFAULT [OPTIONAL] UND a1
2: 00000000 0 NOTYPE GLOBAL DEFAULT [MIPS PLT] UND a2
3: 00000000 0 NOTYPE GLOBAL DEFAULT [MIPS PIC] UND a3
4: 00000000 0 NOTYPE GLOBAL DEFAULT [MICROMIPS] UND a4
5: 00000000 0 NOTYPE GLOBAL DEFAULT [MIPS16] UND a5
6: 00000000 0 NOTYPE GLOBAL DEFAULT [<other>: c] UND b1
7: 00000000 0 NOTYPE GLOBAL DEFAULT [<other>: 28] UND b2

On PPC64 it can print a localentry value that is encoded in the high bits of st_other
63: 0000000000000850 208 FUNC GLOBAL DEFAULT [<localentry>: 8] 12

We chose to print the raw st_other field, prefixed with '0x'.

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

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

5 years ago[Alignment][NFC] Use Align with TargetLowering::setMinFunctionAlignment
Guillaume Chatelet [Fri, 6 Sep 2019 12:48:34 +0000 (12:48 +0000)]
[Alignment][NFC] Use Align with TargetLowering::setMinFunctionAlignment

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: jyknight, sdardis, nemanjai, javed.absar, hiraditya, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, jsji, s.egerton, pzheng, llvm-commits

Tags: #llvm

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

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

5 years ago[test] Update the name of the debug entry values option. NFC
Djordje Todorovic [Fri, 6 Sep 2019 12:23:37 +0000 (12:23 +0000)]
[test] Update the name of the debug entry values option. NFC

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

5 years ago[DFAPacketizer] Track resources for packetized instructions
James Molloy [Fri, 6 Sep 2019 12:20:08 +0000 (12:20 +0000)]
[DFAPacketizer] Track resources for packetized instructions

This patch allows the DFAPacketizer to be queried after a packet is formed to work out which
resources were allocated to the packetized instructions.

This is particularly important for targets that do their own bundle packing - it's not
sufficient to know simply that instructions can share a packet; which slots are used is
also required for encoding.

This extends the emitter to emit a side-table containing resource usage diffs for each
state transition. The packetizer maintains a set of all possible resource states in its
current state. After packetization is complete, all remaining resource states are
possible packetization strategies.

The sidetable is only ~500K for Hexagon, but the extra tracking is disabled by default
(most uses of the packetizer like MachinePipeliner don't care and don't need the extra
maintained state).

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

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

5 years ago[DebugInfo] LiveDebugValues: explicitly terminate overwritten stack locations
Jeremy Morse [Fri, 6 Sep 2019 10:08:22 +0000 (10:08 +0000)]
[DebugInfo] LiveDebugValues: explicitly terminate overwritten stack locations

If a stack spill location is overwritten by another spill instruction,
any variable locations pointing at that slot should be terminated. We
cannot rely on spills always being restored to registers or variable
locations being moved by a DBG_VALUE: the register allocator is entitled
to spill a value and then forget about it when it goes out of liveness.

To address this, scan for memory writes to spill locations, even those we
don't consider to be normal "spills". isSpillInstruction and
isLocationSpill distinguish the two now. After identifying spill
overwrites, terminate the open range, and insert a $noreg DBG_VALUE for
that variable.

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

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

5 years ago[AMDGPU] Mark s_barrier as having side effects but not accessing memory.
Jay Foad [Fri, 6 Sep 2019 10:07:28 +0000 (10:07 +0000)]
[AMDGPU] Mark s_barrier as having side effects but not accessing memory.

Summary:
This fixes poor scheduling in a function containing a barrier and a few
load instructions.

Without this fix, ScheduleDAGInstrs::buildSchedGraph adds an artificial
edge in the dependency graph from the barrier instruction to the exit
node representing live-out latency, with a latency of about 500 cycles.
Because of this it thinks the critical path through the graph also has
a latency of about 500 cycles. And because of that it does not think
that any of the load instructions are on the critical path, so it
schedules them with no regard for their (80 cycle) latency, which gives
poor results.

Reviewers: arsenm, dstuttard, tpr, nhaehnle

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

Tags: #llvm

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

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

5 years agogn build: Merge r371182
Nico Weber [Fri, 6 Sep 2019 09:44:13 +0000 (09:44 +0000)]
gn build: Merge r371182

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

5 years agogn build: Merge r371179
Nico Weber [Fri, 6 Sep 2019 09:44:10 +0000 (09:44 +0000)]
gn build: Merge r371179

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

5 years ago[ARM] Fix for buildbot
Sam Parker [Fri, 6 Sep 2019 09:36:23 +0000 (09:36 +0000)]
[ARM] Fix for buildbot

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

5 years ago[yaml2obj] Rename SHOffset (e_shoff) field to SHOff. NFC
Fangrui Song [Fri, 6 Sep 2019 09:23:17 +0000 (09:23 +0000)]
[yaml2obj] Rename SHOffset (e_shoff) field to SHOff. NFC

`struct Elf*_Shdr` has a field `sh_offset`, named `ShOffset` in
llvm::ELFYAML::Section. Rename SHOffset (e_shoff) to SHOff to prevent confusion.

Reviewed By: grimar

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

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

5 years ago[ARM] MVE Tail Predication
Sam Parker [Fri, 6 Sep 2019 08:24:41 +0000 (08:24 +0000)]
[ARM] MVE Tail Predication

The MVE and LOB extensions of Armv8.1m can be combined to enable
'tail predication' which removes the need for a scalar remainder
loop after vectorization. Lane predication is performed implicitly
via a system register. The effects of predication is described in
Section B5.6.3 of the Armv8.1-m Arch Reference Manual, the key points
being:
- For vector operations that perform reduction across the vector and
  produce a scalar result, whether the value is accumulated or not.
- For non-load instructions, the predicate flags determine if the
  destination register byte is updated with the new value or if the
  previous value is preserved.
- For vector store instructions, whether the store occurs or not.
- For vector load instructions, whether the value that is loaded or
  whether zeros are written to that element of the destination
  register.

This patch implements a pass that takes a hardware loop, containing
masked vector instructions, and converts it something that resembles
an MVE tail predicated loop. Currently, if we had code generation,
we'd generate a loop in which the VCTP would generate the predicate
and VPST would then setup the value of VPR.PO. The loads and stores
would be placed in VPT blocks so this is not tail predication, but
normal VPT predication with the predicate based upon a element
counting induction variable. Further work needs to be done to finally
produce a true tail predicated loop.

Because only the loads and stores are predicated, in both the LLVM IR
and MIR level, we will restrict support to only lane-wise operations
(no horizontal reductions). We will perform a final check on MIR
during loop finalisation too.

Another restriction, specific to MVE, is that all the vector
instructions need operate on the same number of elements. This is
because predication is performed at the byte level and this is set
on entry to the loop, or by the VCTP instead.

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

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

5 years ago[CodeGen] Do the Simple Early Return in block-placement pass to optimize the blocks
Kang Zhang [Fri, 6 Sep 2019 08:16:18 +0000 (08:16 +0000)]
[CodeGen] Do the Simple Early Return in block-placement pass to optimize the blocks

Summary:

Fix a bug of not update the jump table and recommit it again.

In `block-placement` pass, it will create some patterns for unconditional we can do the simple early retrun.
But the `early-ret` pass is before `block-placement`, we don't want to run it again.
This patch is to do the simple early return to optimize the blocks at the last of `block-placement`.

Reviewed By: efriedma

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

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

5 years ago[CMake] LLVM_COMPILE_FLAGS also applies to C files
David Zarzycki [Fri, 6 Sep 2019 07:12:36 +0000 (07:12 +0000)]
[CMake] LLVM_COMPILE_FLAGS also applies to C files

LLVM_COMPILE_FLAGS also applies to C files, otherwise tuning flags,
etc. won't be picked up.

https://reviews.llvm.org/D67171

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

5 years ago[MIR] Change test case to read from stdin instead of file
Mikael Holmen [Fri, 6 Sep 2019 06:55:54 +0000 (06:55 +0000)]
[MIR] Change test case to read from stdin instead of file

The

    ;CHECK: bb
    ;CHECK-NEXT: %namedVReg1353:_(p0) = COPY $d0

parts of the test case failed when the tests were placed in a directory
including "bb" in the path, since the full path of the file is then
output in the
 ; ModuleID = '/repo/bb/
line which the CHECK matched on and then the CHECK-NEXT failed.

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

5 years ago[X86] Add tests for extending and truncating between v16i8 and v16i64 with min-legal...
Craig Topper [Fri, 6 Sep 2019 06:02:17 +0000 (06:02 +0000)]
[X86] Add tests for extending and truncating between v16i8 and v16i64 with min-legal-vector-width=256.

It looks like we might be able to do these in fewer steps, but
I'm not sure.

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

5 years ago[X86] Fix bad indentation. NFC
Craig Topper [Fri, 6 Sep 2019 05:50:46 +0000 (05:50 +0000)]
[X86] Fix bad indentation. NFC

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

5 years agoFix rL371162 again
Alex Brachet [Fri, 6 Sep 2019 03:31:42 +0000 (03:31 +0000)]
Fix rL371162 again

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

5 years agoFix failing test from rL371162
Alex Brachet [Fri, 6 Sep 2019 02:56:48 +0000 (02:56 +0000)]
Fix failing test from rL371162

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

5 years ago[yaml2obj] Make e_phoff and e_phentsize 0 if there are no program headers
Alex Brachet [Fri, 6 Sep 2019 02:27:55 +0000 (02:27 +0000)]
[yaml2obj] Make e_phoff and e_phentsize 0 if there are no program headers

Summary: It says [[ http://www.sco.com/developers/gabi/latest/ch4.eheader.html | here ]] that if there are no program headers than e_phoff should be 0, but currently it is always set after the header. GNU's `readelf` (but not `llvm-readelf`) complains about this: `readelf: Warning: possibly corrupt ELF header - it has a non-zero program header offset, but no program headers`.

Reviewers: jhenderson, grimar, MaskRay, rupprecht

Reviewed By: jhenderson, grimar, MaskRay

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years agogn build: Merge r371159
Nico Weber [Fri, 6 Sep 2019 01:22:13 +0000 (01:22 +0000)]
gn build: Merge r371159

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

5 years ago[MC] Fix undefined behavior in MCInstPrinter::formatHex
Jonas Devlieghere [Fri, 6 Sep 2019 01:13:32 +0000 (01:13 +0000)]
[MC] Fix undefined behavior in MCInstPrinter::formatHex

Passing INT64_MIN to MCInstPrinter::formatHex triggers undefined
behavior because the negation of -9223372036854775808 cannot be
represented in type 'int64_t' (aka 'long long'). This patch puts a
workaround in place to just print the hex value directly.

A possible alternative involves using a small helper functions that uses
(implementation) defined conversions to achieve the desirable value:

  static int64_t helper(int64_t V) {
    auto U = static_cast<uint64_t>(V);
    return V < 0 ? -U : U;
  }

The underlying problem is that MCInstPrinter::formatHex(int64_t) returns
a format_object<int64_t> and should really return a
format_object<uint64_t>. However, that's not possible because formatImm
needs to be able to print both as decimal (where a signed is required)
and hex (where we'd prefer to always have an unsigned).

  format_object<int64_t> formatImm(int64_t Value) const {
    return PrintImmHex ? formatHex(Value) : formatDec(Value);
  }

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

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

5 years agoCleanup test.
Alina Sbirlea [Fri, 6 Sep 2019 00:58:03 +0000 (00:58 +0000)]
Cleanup test.

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

5 years ago[llvm-readobj][yaml2obj] Support SHT_LLVM_SYMPART, SHT_LLVM_PART_EHDR and SHT_LLVM_PA...
Fangrui Song [Fri, 6 Sep 2019 00:53:28 +0000 (00:53 +0000)]
[llvm-readobj][yaml2obj] Support SHT_LLVM_SYMPART, SHT_LLVM_PART_EHDR and SHT_LLVM_PART_PHDR

See http://lists.llvm.org/pipermail/llvm-dev/2019-February/130583.html
and D60242 for the lld partition feature.

This patch:

* Teaches yaml2obj to parse the 3 section types.
* Teaches llvm-readobj/llvm-readelf to dump the 3 section types.

There is no test for SHT_LLVM_DEPENDENT_LIBRARIES in llvm-readobj. Add
it as well.

Reviewed By: thakis

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

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

5 years agoAMDGPU/GlobalISel: Avoid repeating 32-bit type lists
Matt Arsenault [Fri, 6 Sep 2019 00:36:10 +0000 (00:36 +0000)]
AMDGPU/GlobalISel: Avoid repeating 32-bit type lists

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

5 years agoAMDGPU/GlobalISel: Fix load/store of types in other address spaces
Matt Arsenault [Fri, 6 Sep 2019 00:36:06 +0000 (00:36 +0000)]
AMDGPU/GlobalISel: Fix load/store of types in other address spaces

There should probably be a size only matcher.

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

5 years agoGlobalISel/TableGen: Fix handling of EXTRACT_SUBREG constraints
Matt Arsenault [Fri, 6 Sep 2019 00:05:58 +0000 (00:05 +0000)]
GlobalISel/TableGen: Fix handling of EXTRACT_SUBREG constraints

This was only using the correct register constraints if this was the
final result instruction. If the extract was a sub instruction of the
result, it would attempt to use GIR_ConstrainSelectedInstOperands on a
COPY, which won't work. Move the handling to
createAndImportSubInstructionRenderer so it works correctly.

I don't fully understand why runOnPattern and
createAndImportSubInstructionRenderer both need to handle these
special cases, and constrain them with slightly different methods. If
I remove the runOnPattern handling, it does break the constraint when
the final result instruction is EXTRACT_SUBREG.

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

5 years agoAMDGPU: Allow getMemOperandWithOffset to analyze stack accesses
Matt Arsenault [Thu, 5 Sep 2019 23:54:35 +0000 (23:54 +0000)]
AMDGPU: Allow getMemOperandWithOffset to analyze stack accesses

Report soffset as a base register if the scratch resource can be
ignored.

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

5 years agoAMDGPU: Fix emitting multiple stack loads for stack passed workitems
Matt Arsenault [Thu, 5 Sep 2019 23:40:14 +0000 (23:40 +0000)]
AMDGPU: Fix emitting multiple stack loads for stack passed workitems

The same stack is loaded for each workitem ID, and each use. Nothing
prevents you from creating multiple fixed stack objects with the same
offsets, so this was creating a load for each unique frame index,
despite them being the same offset. Re-use the same frame index so the
loads are CSEable.

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

5 years ago[AArch64] Add testcase for codegen for sdiv by 2.
Eli Friedman [Thu, 5 Sep 2019 23:40:03 +0000 (23:40 +0000)]
[AArch64] Add testcase for codegen for sdiv by 2.

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

5 years agoInstCombine: Fix crash on icmp of gep with addrspacecasted null
Matt Arsenault [Thu, 5 Sep 2019 23:39:21 +0000 (23:39 +0000)]
InstCombine: Fix crash on icmp of gep with addrspacecasted null

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

5 years agollvm-reduce: Use %python from lit to get the correct/valid python binary for the...
David Blaikie [Thu, 5 Sep 2019 23:33:44 +0000 (23:33 +0000)]
llvm-reduce: Use %python from lit to get the correct/valid python binary for the reduction script

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

5 years agoAMDGPU: Fix Register copypaste error
Matt Arsenault [Thu, 5 Sep 2019 23:07:10 +0000 (23:07 +0000)]
AMDGPU: Fix Register copypaste error

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

5 years ago[AliasSetTracker] Correct AAInfo check.
Alina Sbirlea [Thu, 5 Sep 2019 23:00:36 +0000 (23:00 +0000)]
[AliasSetTracker] Correct AAInfo check.

Properly check if NewAAInfo conflicts with AAInfo.
Update local variable and alias set that a change occured when a conflict is found.
Resolves PR42969.

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

5 years ago[SimplifyCFG] Don't SimplifyBranchOnICmpChain with ExtraCase
Vitaly Buka [Thu, 5 Sep 2019 22:49:34 +0000 (22:49 +0000)]
[SimplifyCFG] Don't SimplifyBranchOnICmpChain with ExtraCase

Summary:
Here we try to avoid issues with "explicit branch" with SimplifyBranchOnICmpChain
which can check on undef. Msan by design reports branches on uninitialized
memory and undefs, so we have false report here.

In general msan does not like when we convert

```
// If at least one of them is true we can MSAN is ok if another is undefs
if (a || b)
  return;
```
into
```
// If 'a' is undef MSAN will complain even if 'b' is true
if (a)
  return;
if (b)
  return;
```

Example

Before optimization we had something like this:
```
while (true) {
  bool maybe_undef = doStuff();

  while (true) {
    char c = getChar();
    if (c != 10 && c != 13)
     continue
    break;
  }

  // we know that c == 10 || c == 13 if we get here,
  // so msan know that branch is not affected by maybe_undef
  if (maybe_undef || c == 10 || c == 13)
    continue;
  return;
}
```

SimplifyBranchOnICmpChain will convert that into
```
while (true) {
  bool maybe_undef = doStuff();

  while (true) {
    char c = getChar();
    if (c != 10 && c != 13)
      continue;
    break;
  }

  // however msan will complain here:
  if (maybe_undef)
    continue;

  // we know that c == 10 || c == 13, so either way we will get continue
  switch(c) {
    case 10: continue;
    case 13: continue;
  }
  return;
}
```

Reviewers: eugenis, efriedma

Reviewed By: eugenis, efriedma

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years agoAMDGPU: Avoid constructing new std::vector in initCandidate
Matt Arsenault [Thu, 5 Sep 2019 22:44:06 +0000 (22:44 +0000)]
AMDGPU: Avoid constructing new std::vector in initCandidate

Approximately 30% of the time was spent in the std::vector
constructor. In one testcase this pushes the scheduler to being the
second slowest pass.

I'm not sure I understand why these vector are necessary. The default
scheduler initCandidate seems to use some pre-existing vectors for the
pressure.

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

5 years agogn build: Merge r371134
Nico Weber [Thu, 5 Sep 2019 22:40:47 +0000 (22:40 +0000)]
gn build: Merge r371134

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

5 years ago[Remarks] Add comparison operators to the Remark object
Francis Visoiu Mistrih [Thu, 5 Sep 2019 22:35:37 +0000 (22:35 +0000)]
[Remarks] Add comparison operators to the Remark object

and related structs.

This also adds tests for the remarks::Remark object in general.

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

5 years ago[ADT] Add makeArrayRef(std::array<>) template specialization
Jan Korous [Thu, 5 Sep 2019 21:27:25 +0000 (21:27 +0000)]
[ADT] Add makeArrayRef(std::array<>) template specialization

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

5 years ago[Bitstream] Add BitCodeAbbrev(std::initializer_list) constructor
Jan Korous [Thu, 5 Sep 2019 21:26:53 +0000 (21:26 +0000)]
[Bitstream] Add BitCodeAbbrev(std::initializer_list) constructor

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

5 years agoDocs: Update Community section on homepage
DeForest Richards [Thu, 5 Sep 2019 21:24:47 +0000 (21:24 +0000)]
Docs: Update Community section on homepage

This commit includes the following changes: Adds a Getting Involved section under Community. Moves the Development Process section under Community. Moves Sphinx Quickstart Template and How to submit an LLVM bug report from User Guides section to Getting Involved.

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

5 years ago[GSYM][NFC] Fixed -Wdocumentation warning
David Bolvansky [Thu, 5 Sep 2019 21:09:58 +0000 (21:09 +0000)]
[GSYM][NFC] Fixed -Wdocumentation warning

lib/DebugInfo/GSYM/InlineInfo.cpp:68:12: warning: parameter 'Inline' not found in the function declaration [-Wdocumentation]

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