platform/upstream/llvm.git
4 years ago[VPlan] Use VPUser for VPWidenSelectRecipe operands (NFC).
Florian Hahn [Sun, 24 May 2020 12:36:42 +0000 (13:36 +0100)]
[VPlan] Use VPUser for VPWidenSelectRecipe operands (NFC).

VPWidenSelectRecipe already contains a VPUser, but it is not used. This
patch updates the code related to VPWidenSelectRecipe to use VPUser for
its operands.

Reviewers: Ayal, gilr, rengolin

Reviewed By: gilr

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

4 years agoAMDGPUTargetObjectFile.h - remove unnecessary includes. NFC.
Simon Pilgrim [Sun, 24 May 2020 12:57:02 +0000 (13:57 +0100)]
AMDGPUTargetObjectFile.h - remove unnecessary includes. NFC.

As we're inheriting from TargetLoweringObjectFileELF, TargetLoweringObjectFileImpl.h already declares all types we require in the overrides.

4 years agoAMDGPULibFunc - fix include order. NFC.
Simon Pilgrim [Sun, 24 May 2020 12:25:59 +0000 (13:25 +0100)]
AMDGPULibFunc - fix include order. NFC.

Ensure AMDGPULibFunc.h module header is first, and fix exposed missing forward declaration.

4 years agoLoopSimplify.h - reduce unnecessary includes to forward declarations. NFC.
Simon Pilgrim [Sun, 24 May 2020 11:41:05 +0000 (12:41 +0100)]
LoopSimplify.h - reduce unnecessary includes to forward declarations. NFC.

4 years agoFix return values of some matcher functions
Stephen Kelly [Sat, 23 May 2020 20:57:01 +0000 (21:57 +0100)]
Fix return values of some matcher functions

The old return values mean

* implicit conversion
* not being able to write sizeOfExpr().bind() for example

4 years agoFix skip-invisible with overloaded method calls
Stephen Kelly [Sun, 24 May 2020 11:27:03 +0000 (12:27 +0100)]
Fix skip-invisible with overloaded method calls

4 years agoAdd explicit traversal mode to matchers for implicit constructors
Stephen Kelly [Sun, 24 May 2020 10:49:13 +0000 (11:49 +0100)]
Add explicit traversal mode to matchers for implicit constructors

4 years agoX86Subtarget.h - remove unnecessary TargetMachine.h include. NFC.
Simon Pilgrim [Sun, 24 May 2020 11:30:22 +0000 (12:30 +0100)]
X86Subtarget.h - remove unnecessary TargetMachine.h include. NFC.

By moving X86Subtarget::isPositionIndependent() into X86Subtarget.cpp we can remove the header dependency and move the few uses into source files.

4 years ago[X86] Pull out repeated DemandedBits signmask variable. NFC.
Simon Pilgrim [Sun, 24 May 2020 11:01:58 +0000 (12:01 +0100)]
[X86] Pull out repeated DemandedBits signmask variable. NFC.

Both paths always create the same DemandedBits mask.

4 years ago[TargetLowering] Improve expandFunnelShift shift amount masking
Simon Pilgrim [Sun, 24 May 2020 10:25:09 +0000 (11:25 +0100)]
[TargetLowering] Improve expandFunnelShift shift amount masking

For the 'inverse shift', we currently always perform a subtraction of the original (masked) shift amount.

But for the case where we are handling power-of-2 type widths, we can replace:

(sub bw-1, (and amt, bw-1) ) -> (and (xor amt, bw-1), bw-1) -> (and ~amt, bw-1)

This allows x86 shifts to fold away the and-mask.

Followup to D77301 + D80466.

http://volta.cs.utah.edu:8080/z/Nod0Gr

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

4 years agoFix Wdocumentation warnings after argument renaming. NFC.
Simon Pilgrim [Sun, 24 May 2020 10:18:20 +0000 (11:18 +0100)]
Fix Wdocumentation warnings after argument renaming. NFC.

4 years ago[X86] Move CONCAT_VECTORS/INSERT_SUBVECTOR actions inside loop. NFC.
Simon Pilgrim [Sun, 24 May 2020 09:59:33 +0000 (10:59 +0100)]
[X86] Move CONCAT_VECTORS/INSERT_SUBVECTOR actions inside loop. NFC.

CONCAT_VECTORS/INSERT_SUBVECTOR both are custom on v32i1/v64i1 like the other ops in the loop.

4 years agoX86TargetMachine.h - remove unnecessary X86Subtarget forward declaration. NFC.
Simon Pilgrim [Sun, 24 May 2020 09:51:02 +0000 (10:51 +0100)]
X86TargetMachine.h - remove unnecessary X86Subtarget forward declaration. NFC.

We have to include X86Subtarget.h.

4 years ago[LLD/MinGW]: Expose --thinlto-cache-dir
Tobias Hieta [Sun, 24 May 2020 09:29:16 +0000 (12:29 +0300)]
[LLD/MinGW]: Expose --thinlto-cache-dir

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

4 years ago[X86][AVX] Call SimplifyDemandedBits on MaskedLoadSDNode with non-boolean masks
Simon Pilgrim [Sun, 24 May 2020 08:41:02 +0000 (09:41 +0100)]
[X86][AVX] Call SimplifyDemandedBits on MaskedLoadSDNode with non-boolean masks

On X86 (AVX1/AVX2), non-boolean masked loads only demand the sign bit of the mask, we already do the equivalent for masked stores.

Annoyingly I can't easily handle this inside TargetLowering::SimplifyDemandedBits as this is an x86 specific case for a generic node.

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

4 years ago[X86] Add family/model for Intel Comet Lake CPUs for -march=native and function multi...
Craig Topper [Wed, 20 May 2020 04:05:31 +0000 (21:05 -0700)]
[X86] Add family/model for Intel Comet Lake CPUs for -march=native and function multiversioning

This adds the family/model returned by CPUID for some Intel
Comet Lake CPUs. Instruction set and tuning wise these are
the same as "skylake".

These are not in the Intel SDM yet, but these should be correct.

4 years ago[X86] Fix typo in comment. NFC
Craig Topper [Sun, 24 May 2020 03:23:24 +0000 (20:23 -0700)]
[X86] Fix typo in comment. NFC

4 years ago[X86] Improve i8 + 'slow' i16 funnel shift codegen
Simon Pilgrim [Sun, 24 May 2020 07:08:34 +0000 (08:08 +0100)]
[X86] Improve i8 + 'slow' i16 funnel shift codegen

This is a preliminary patch before I deal with the xor+and issue raised in D77301.

We get much better code for i8/i16 funnel shifts by concatenating the operands together and performing the shift as a double width type, it avoids repeated use of the shift amount and partial registers.

fshl(x,y,z) -> (((zext(x) << bw) | zext(y)) << (z & (bw-1))) >> bw.
fshr(x,y,z) -> (((zext(x) << bw) | zext(y)) >> (z & (bw-1))) >> bw.

Alive2: http://volta.cs.utah.edu:8080/z/CZx7Cn

This doesn't do as well for i32 cases on x86_64 (the xor+and followup patch is much better) so I haven't bothered with that.

Cases with constant amounts are more dubious as well so I haven't currently bothered with those - its these kind of 'edge' cases that put me off trying to put this in TargetLowering::expandFunnelShift.

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

4 years ago[AArch64][GlobalISel] When generating SUBS for compares, don't write to wzr/xzr.
Amara Emerson [Fri, 22 May 2020 22:22:29 +0000 (15:22 -0700)]
[AArch64][GlobalISel] When generating SUBS for compares, don't write to wzr/xzr.

Although writing to wzr/xzr is correct since we don't care about the result
of the sub, only the flags, doing so causes tail merge blocks to fail.

Writing to an unused virtual register instead allows the optimization to fire,
improving performance significantly on 256.bzip2.

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

4 years ago[NFC, StackSafety] LTO tests for MTE and StackSafety
Vitaly Buka [Fri, 15 May 2020 21:44:52 +0000 (14:44 -0700)]
[NFC, StackSafety] LTO tests for MTE and StackSafety

Summary:
The test demonstrates the current state of the compiler and
I am going to resolve FIXME in followup patches.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: inglorion, hiraditya, steven_wu, dexonsmith, cfe-commits

Tags: #clang

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

4 years ago[clang driver] Spell "--export-dynamic-symbol" with two dashes.
Eli Friedman [Sat, 23 May 2020 22:46:28 +0000 (15:46 -0700)]
[clang driver] Spell "--export-dynamic-symbol" with two dashes.

This doesn't make a difference for linkers that support the option, but
it improves the error message from older linkers that don't support it.

4 years ago[TLI][PowerPC] Introduce TLI query to check if MULH is cheaper than MUL + SHIFT
Amy Kwan [Sat, 23 May 2020 21:46:33 +0000 (16:46 -0500)]
[TLI][PowerPC] Introduce TLI query to check if MULH is cheaper than MUL + SHIFT

This patch introduces a TargetLowering query, isMulhCheaperThanMulShift.

Currently in DAG Combine, it will transform mulhs/mulhu into a
wider multiply and a shift if the wide multiply is legal.

This TLI function is implemented on 64-bit PowerPC, as it is more desirable to
have multiply-high over multiply + shift for words and doublewords. Having
multiply-high can also aid in further transformations that can be done.

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

4 years ago[libcxx] Fix deprecation warning by suppressing deprecated around
zoecarver [Sat, 23 May 2020 21:32:12 +0000 (14:32 -0700)]
[libcxx] Fix deprecation warning by suppressing deprecated around
__test_has_construct.

In C++17 some tests started failing after a521532aa16df2c06c91488f2a4e787586f0a611. This fixes those errors by suppressing the deprecation warning when calling `construct` in `__test_has_construct`. This is the same solution as `__has_destroy_test` already uses.

Reviewers: ldionne, #libc!

Subscribers: dexonsmith, libcxx-commits

Tags: #libc

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

4 years ago[CFIInstrInserter] Delete unneeded checks
Fangrui Song [Sat, 23 May 2020 21:00:33 +0000 (14:00 -0700)]
[CFIInstrInserter] Delete unneeded checks

4 years ago[NFC] Remove non-variadic overloads of allocator_traits::construct.
zoecarver [Sat, 23 May 2020 21:03:04 +0000 (14:03 -0700)]
[NFC] Remove non-variadic overloads of allocator_traits::construct.

Summary:
Libcxx only supports compilers with variadics. We can safely remove all "fake" variadic overloads of allocator_traits::construct.

This also provides the correct behavior if anything other than exactly one argument is supplied to allocator_traits::construct in C++03 mode.

Reviewers: ldionne, #libc!

Subscribers: dexonsmith, libcxx-commits

Tags: #libc

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

4 years agoRevert "[lldb/Interpreter] Fix another eExpressionThreadVanished warning"
Jonas Devlieghere [Sat, 23 May 2020 20:37:46 +0000 (13:37 -0700)]
Revert "[lldb/Interpreter] Fix another eExpressionThreadVanished warning"

This reverts commit f2ffa33c79d3d0636d6c8eb7b5b7bcf8db7b397b. My local
checkout was behind and Eric already took care of it in the meantime.

4 years ago[lldb/Interpreter] Fix another eExpressionThreadVanished warning
Jonas Devlieghere [Sat, 23 May 2020 20:27:01 +0000 (13:27 -0700)]
[lldb/Interpreter] Fix another eExpressionThreadVanished warning

Fixes warning: enumeration value 'eExpressionThreadVanished' not handled
in switch [-Wswitch] in CommandInterpreter.cpp.

4 years ago[docs] Fix warnings in ConstantInterpreter
Jinsong Ji [Sat, 23 May 2020 19:01:37 +0000 (19:01 +0000)]
[docs] Fix warnings in ConstantInterpreter

Fixed following trivial issues that caught by warnings by adding
indents.

clang/docs/ConstantInterpreter.rst:133: WARNING: Bullet list ends
without a blank line; unexpected unindent.
clang/docs/ConstantInterpreter.rst:136: WARNING: Bullet list ends
without a blank line; unexpected unindent.
clang/docs/ConstantInterpreter.rst:153: WARNING: Bullet list ends
without a blank line; unexpected unindent.
clang/docs/ConstantInterpreter.rst:195: WARNING: Bullet list ends
without a blank line; unexpected unindent.
clang/docs/ConstantInterpreter.rst:225: WARNING: Bullet list ends
without a blank line; unexpected unindent.
clang/docs/ConstantInterpreter.rst:370: WARNING: Bullet list ends
without a blank line; unexpected unindent.
clang/docs/ConstantInterpreter.rst:383: WARNING: Bullet list ends
without a blank line; unexpected unindent.

4 years ago[ValueTracking] Use assumptions in computeConstantRange.
Florian Hahn [Fri, 22 May 2020 18:16:15 +0000 (19:16 +0100)]
[ValueTracking] Use assumptions in computeConstantRange.

This patch updates computeConstantRange to optionally take an assumption
cache as argument and use the available assumptions to limit the range
of the result.

Currently this is limited to assumptions that are comparisons.

Reviewers: reames, nikic, spatel, jdoerfert, lebedev.ri

Reviewed By: nikic

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

4 years ago[DwarfEHPrepare] Don't prune unreachable resumes at optnone
Nikita Popov [Thu, 21 May 2020 17:40:43 +0000 (19:40 +0200)]
[DwarfEHPrepare] Don't prune unreachable resumes at optnone

Disable pruning of unreachable resumes in the DwarfEHPrepare pass
at optnone. While I expect the pruning itself to be essentially free,
this does require a dominator tree calculation, that is not used for
anything else. Saving this DT construction makes for a 0.4% O0
compile-time improvement.

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

4 years agoTargetLowering.h - remove unnecessary TargetMachine.h include. NFC
Simon Pilgrim [Sat, 23 May 2020 18:49:38 +0000 (19:49 +0100)]
TargetLowering.h - remove unnecessary TargetMachine.h include. NFC

Replace with forward declaration and move dependency down to source files that actually need it.

Both TargetLowering.h and TargetMachine.h are 2 of the most expensive headers (top 10) in the ClangBuildAnalyzer report when building llc.

4 years agoSimplifyCFG: Clean up optforfuzzing implementation
Matt Arsenault [Thu, 21 May 2020 00:05:07 +0000 (20:05 -0400)]
SimplifyCFG: Clean up optforfuzzing implementation

This should function as any other SimplifyCFGOption rather than having
the transform check and specially consider the attribute itself.

4 years agoAMDGPU: Refine rcp/rsq intrinsic folding for modern FP rules
Matt Arsenault [Fri, 22 May 2020 01:04:06 +0000 (21:04 -0400)]
AMDGPU: Refine rcp/rsq intrinsic folding for modern FP rules

We have to assume undef could be an snan, which would need quieting so
returning qnan is safer than undef. Also consider strictfp, and don't
care if the result rounded.

4 years agoHIP: Try to deal with more llvm package layouts
Matt Arsenault [Fri, 22 May 2020 23:00:04 +0000 (19:00 -0400)]
HIP: Try to deal with more llvm package layouts

The various HIP builds are all inconsistent.

The default llvm install goes to ${INSTALL_PREFIX}/bin/clang, but the
rocm packaging scripts move this under
${INSTALL_PREFIX}/llvm/bin/clang. Some other builds further pollute
this with ${INSTALL_PREFIX}/bin/x86_64/clang. These should really be
consolidated, but try to handle them for now.

4 years agoAMDGPU: Implement isConstantPhysReg
Matt Arsenault [Thu, 21 May 2020 01:05:47 +0000 (21:05 -0400)]
AMDGPU: Implement isConstantPhysReg

I don't think any of these registers are used in contexts where this
would do anything yet.

4 years agoAMDGPU: Define mode register
Matt Arsenault [Fri, 3 Jan 2020 20:26:46 +0000 (15:26 -0500)]
AMDGPU: Define mode register

This should eventually model FP mode constraints as well as the other
special fields it tracks.

4 years agoSilence warning from unit test
Matt Arsenault [Fri, 22 May 2020 23:57:45 +0000 (19:57 -0400)]
Silence warning from unit test

This was printing about r600 not being a valid subtarget for an amdgcn
triple. This is an awkward place because r600 and amdgcn unfortunately
occupy the same target. Silence the warning by specifying an explicit
subtarget.

4 years ago[ELF] Parse SHT_GNU_verneed and respect versioned undefined symbols in shared objects
Fangrui Song [Sat, 16 May 2020 03:36:41 +0000 (20:36 -0700)]
[ELF] Parse SHT_GNU_verneed and respect versioned undefined symbols in shared objects

An undefined symbol in a shared object can be versioned, like `f@v1`.
We currently insert `f` as an Undefined into the symbol table, but we
should insert `f@v1` instead.

The string `v1` is inferred from SHT_GNU_versym and SHT_GNU_verneed.
This patch implements the functionality.

Failing to do this can cause two issues:

* If a versioned symbol referenced by a shared object is defined in the
  executable, we will fail to export it.
* If a versioned symbol referenced by a shared object in another object
  file, --no-allow-shlib-undefined may spuriously report an
  "undefined reference to " error. See https://bugs.llvm.org/show_bug.cgi?id=44842
  (Linking -lfftw3 -lm on Arch Linux can cause
  `undefined reference to __log_finite`)

Reviewed By: grimar

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

4 years agoTableGen: Don't reconstruct CodeGenDAGTarget
Matt Arsenault [Sat, 23 May 2020 15:55:20 +0000 (11:55 -0400)]
TableGen: Don't reconstruct CodeGenDAGTarget

This is quite expensive and it's already available.

Just ReadLegalValueTypes is taking 4 seconds for me in a debug build
for AMDGPU's -gen-instr-info, and this was introducing a second call.

4 years ago[yaml2obj] - Move "repeated section/fill name" check earlier.
Georgii Rymar [Thu, 14 May 2020 19:46:58 +0000 (22:46 +0300)]
[yaml2obj] - Move "repeated section/fill name" check earlier.

This allows to simplify the code.
Doing checks early is generally useful.

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

4 years ago[yaml2obj] - Add a technical prefix for each unnamed chunk.
Georgii Rymar [Thu, 14 May 2020 18:44:06 +0000 (21:44 +0300)]
[yaml2obj] - Add a technical prefix for each unnamed chunk.

This change does not affect the produced binary.

In this patch I assign a technical suffix to each section/fill
(i.e. chunk) name when it is empty. It allows to simplify the code
slightly and improve error messages reported.

In the code we have the section to index mapping, SN2I, which is
globally used. With this change we can use it to map "empty"
names to indexes now, what is helpful.

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

4 years agoAdd a way to set traversal mode in clang-query
Stephen Kelly [Sun, 29 Dec 2019 19:26:11 +0000 (19:26 +0000)]
Add a way to set traversal mode in clang-query

Reviewers: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[libc++] Mark __cpp_lib_hardware_interference_size as unimplemented. This fxes bug...
Marek Kurdej [Sat, 23 May 2020 12:31:05 +0000 (14:31 +0200)]
[libc++] Mark __cpp_lib_hardware_interference_size as unimplemented. This fxes bug PR41423.

Summary:
As described in the bug report:
The commit a8b9f59e8caf378d56e8bfcecdb22184cdabf42d "Implement feature test macros using a script" added test features macros for libc++. Among others, it added `__cpp_lib_hardware_interference_size`. However, there is nothing like std::hardware_constructive_interference_size nor std::hardware_destructive_interference_size, that should be in header <new>.

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

Reviewed By: ldionne, #libc

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

4 years agoRevert "Added a new IRCanonicalizer pass."
Michal Paszkowski [Sat, 23 May 2020 11:51:43 +0000 (13:51 +0200)]
Revert "Added a new IRCanonicalizer pass."

This reverts commit 14d358537f124a732adad1ec6edf3981dc9baece.

4 years agoRevert "[gn build] Port 14d358537f1"
Michal Paszkowski [Sat, 23 May 2020 11:51:07 +0000 (13:51 +0200)]
Revert "[gn build] Port 14d358537f1"

This reverts commit a0c7108b99f834cd7571ae57872116a4ef2682d9.

4 years ago[gn build] Port 14d358537f1
LLVM GN Syncbot [Sat, 23 May 2020 11:05:09 +0000 (11:05 +0000)]
[gn build] Port 14d358537f1

4 years agoAdded a new IRCanonicalizer pass.
Michal Paszkowski [Sat, 23 May 2020 00:48:55 +0000 (02:48 +0200)]
Added a new IRCanonicalizer pass.

Summary:
Added a new IRCanonicalizer pass which aims to transform LLVM modules into
a canonical form by reordering and renaming instructions while preserving the
same semantics. The canonicalizer makes it easier to spot semantic differences
when diffing two modules which have undergone different passes.

Presentation: https://www.youtube.com/watch?v=c9WMijSOEUg

Reviewed by: plotfi

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

4 years ago[Analyzer][WebKit][NFC] Correct documentation to avoid sphinx build error
mydeveloperday [Sat, 23 May 2020 10:28:06 +0000 (11:28 +0100)]
[Analyzer][WebKit][NFC] Correct documentation to avoid sphinx build error

This was introduced with commit 54e91a3c7010

4 years ago[TargetPassConfig] Don't add alias analysis at optnone
Nikita Popov [Tue, 19 May 2020 20:37:37 +0000 (22:37 +0200)]
[TargetPassConfig] Don't add alias analysis at optnone

When performing codegen at optnone, don't add alias analysis to
the pipeline. We don't need it, but it causes an unnecessary
dominator tree calculation.

I've also moved the module verifier call to the top so that a bunch
of disabled-at-optnone passes group more nicely.

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

4 years ago[Align] Remove operations on MaybeAlign that asserted that it had a defined value.
Craig Topper [Sat, 23 May 2020 04:45:09 +0000 (21:45 -0700)]
[Align] Remove operations on MaybeAlign that asserted that it had a defined value.

If the caller needs to reponsible for making sure the MaybeAlign
has a value, then we should just make the caller convert it to an Align
with operator*.

I explicitly deleted the relational comparison operators that
were being inherited from Optional. It's unclear what the meaning
of two MaybeAligns were one is defined and the other isn't
should be. So make the caller reponsible for defining the behavior.

I left the ==/!= operators from Optional. But now that exposed a
weird quirk that ==/!= between Align and MaybeAlign required the
MaybeAlign to be defined. But now we use the operator== from
Optional that takes an Optional and the Value.

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

4 years ago[MC] Drop unneeded std::abs for DW_def_cfa_offset in DarwinX86AsmBackend::generateCom...
Fangrui Song [Sat, 23 May 2020 04:12:17 +0000 (21:12 -0700)]
[MC] Drop unneeded std::abs for DW_def_cfa_offset in DarwinX86AsmBackend::generateCompactUnwindEncoding

This clean-up is available after double negation bugs are fixed.

4 years ago[MC] Fix double negation of DW_CFA_def_cfa
Fangrui Song [Sat, 23 May 2020 03:18:15 +0000 (20:18 -0700)]
[MC] Fix double negation of DW_CFA_def_cfa

Negations are incorrectly added in numerous places and the code just happens to work.
Also fix a missed DW_CFA_def_cfa_offset negation in c693b9c321d5a40d012340619674cf790c9ac86c:
ARMAsmBackendDarwin::generateCompactUnwindEncoding

4 years ago[X86] Update some av512 shift intrinsics to use "unsigned int" parameter instead...
Craig Topper [Sat, 23 May 2020 03:12:57 +0000 (20:12 -0700)]
[X86] Update some av512 shift intrinsics to use "unsigned int" parameter instead of int to match Intel documentation

There are 65 that take a scalar shift amount. Intel documentation shows 60 of them taking unsigned int. There are 5 versions of srli_epi16 that use int, the 512-bit maskz and 128/256 mask/maskz.

Fixes PR45931

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

4 years ago[MC] Fix double negation of DW_CFA_def_cfa_offset
Fangrui Song [Sat, 23 May 2020 02:57:21 +0000 (19:57 -0700)]
[MC] Fix double negation of DW_CFA_def_cfa_offset

Negations are incorrectly added in two places and the code works just
because the negations cancel each other.

4 years ago[AMDGPU] DWARF Proposal For Heterogeneous Debugging
Tony [Sat, 23 May 2020 02:29:57 +0000 (22:29 -0400)]
[AMDGPU] DWARF Proposal For Heterogeneous Debugging

- Change title to "DWARF Proposal For Heterogeneous Debugging".

4 years ago[AMDGPU] DWARF For Heterogeneous Debugging
Tony [Sat, 23 May 2020 02:01:01 +0000 (22:01 -0400)]
[AMDGPU] DWARF For Heterogeneous Debugging

- Change title to "DWARF For Heterogeneous Debugging".
- Add "Examples" section that references the AMDGPUUsage DWARF section.
- Make the "References" section a top level section.

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

4 years agoAdd missing unit test
Stephen Kelly [Sat, 23 May 2020 00:28:55 +0000 (01:28 +0100)]
Add missing unit test

4 years agoFix mistake made while rebasing
Stephen Kelly [Sat, 23 May 2020 00:24:56 +0000 (01:24 +0100)]
Fix mistake made while rebasing

4 years ago[MC] Change MCCFIInstruction::createDefCfaOffset to cfiDefCfaOffset which does not...
Fangrui Song [Fri, 22 May 2020 22:51:24 +0000 (15:51 -0700)]
[MC] Change MCCFIInstruction::createDefCfaOffset to cfiDefCfaOffset which does not negate Offset

The negative Offset has caused a bunch of problems and confused quite a
few call sites. Delete the unneeded negation and fix all call sites.

4 years agoAdd some explicit use of TK_AsIs
Stephen Kelly [Fri, 22 May 2020 21:48:54 +0000 (22:48 +0100)]
Add some explicit use of TK_AsIs

4 years agoFix ignoring traversal of intermediate parens
Stephen Kelly [Thu, 21 May 2020 23:57:50 +0000 (00:57 +0100)]
Fix ignoring traversal of intermediate parens

4 years agoTraverse-ignore invisible CXXConstructExprs with default args
Stephen Kelly [Thu, 21 May 2020 23:23:59 +0000 (00:23 +0100)]
Traverse-ignore invisible CXXConstructExprs with default args

4 years agoRestrict test for DW_AT_APPLE_optimized to Darwin
Adrian Prantl [Fri, 22 May 2020 22:51:43 +0000 (15:51 -0700)]
Restrict test for DW_AT_APPLE_optimized to Darwin

4 years ago[MC] Change MCCFIInstruction::createDefCfa to cfiDefCfa which does not negate Offset
Fangrui Song [Fri, 22 May 2020 22:18:05 +0000 (15:18 -0700)]
[MC] Change MCCFIInstruction::createDefCfa to cfiDefCfa which does not negate Offset

The negative Offset has caused a bunch of problems and confused quite a
few call sites. Delete the unneeded negation and fix all call sites.

4 years agoPrint a warning when stopped in a frame LLDB has no plugin for.
Adrian Prantl [Fri, 22 May 2020 00:42:24 +0000 (17:42 -0700)]
Print a warning when stopped in a frame LLDB has no plugin for.

This patchs adds an optional warning that is printed when stopped at a
frame that was compiled in a source language that LLDB has no plugin
for.

The motivational use-case is debugging Swift code on Linux. When the
user accidentally invokes the system LLDB that was built without the
Swift plugin, it is very much non-obvious why debugging doesnt
work. This warning makes it easy to figure out what went wrong.

<rdar://problem/56986569>

4 years agoReapply "[lit] GoogleTest framework should report failures if test binary crashes"
Stephen Neuendorffer [Thu, 21 May 2020 17:52:44 +0000 (10:52 -0700)]
Reapply "[lit] GoogleTest framework should report failures if test binary crashes"

This reverts commit 78dea0e8fb6cc5c0fae64d65b7f40560cab7b329.

The offending lldb test (which is a real bug exposed by this patch)
has been disabled on windows (see a67b2faa7c4cfbceffb4213f46769c45a5a9291a)
and lldb is queued for inclusion into precommit testing, which would
have caught this.

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

4 years ago[AMDGPU] Define 6 dword subregs
Stanislav Mekhanoshin [Fri, 22 May 2020 18:04:46 +0000 (11:04 -0700)]
[AMDGPU] Define 6 dword subregs

This prevents autogeneration of degenerate names for these.

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

4 years agoHandle eExpressionThreadVanished in error switch to handle
Eric Christopher [Fri, 22 May 2020 20:42:09 +0000 (13:42 -0700)]
Handle eExpressionThreadVanished in error switch to handle
covered switch warning.

4 years ago[VectorCombine] set preserve alias analysis
Sanjay Patel [Fri, 22 May 2020 20:22:27 +0000 (16:22 -0400)]
[VectorCombine] set preserve alias analysis

As noted in D80236, moving the pass in the pipeline exposed this
shortcoming. Extra work to recalculate the alias results showed
up as a compile-time slowdown.

4 years ago[libc++] Mark __u64toa and __u32toa as noexcept
Louis Dionne [Thu, 21 May 2020 14:25:15 +0000 (10:25 -0400)]
[libc++] Mark __u64toa and __u32toa as noexcept

The two functions don't throw, and the generated code is better when
we explicitly tell the compiler that the functions are noexcept. This
isn't an ABI break because the signatures of the functions stay the
same with or without noexcept.

Fixes https://llvm.org/PR46016

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

4 years ago[lldb/Test] Disable APITests.exe on Windows
Jonas Devlieghere [Fri, 22 May 2020 20:06:36 +0000 (13:06 -0700)]
[lldb/Test] Disable APITests.exe on Windows

The generated binary (APITests.exe) is not a valid googletest binary. I
suspect it has something to do with us linking against liblldb.

4 years ago[lldb/Reproducers] Make the type tests work with reproducers
Jonas Devlieghere [Fri, 22 May 2020 20:06:01 +0000 (13:06 -0700)]
[lldb/Reproducers] Make the type tests work with reproducers

4 years ago[PowerPC] Add support for vmsumudm
Ahsan Saghir [Fri, 22 May 2020 19:35:13 +0000 (14:35 -0500)]
[PowerPC] Add support for vmsumudm

This patch adds support for Vector Multiply-Sum Unsigned Doubleword Modulo
instruction; vmsumudm.

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

4 years ago[libc++] Fix broken tuple tests
Louis Dionne [Fri, 22 May 2020 19:32:29 +0000 (15:32 -0400)]
[libc++] Fix broken tuple tests

The tests had copy-paste errors which started showing when an
unused-variable warning started being emitted after we made
the MoveOnly type constexpr (in a4b8ee64223f).

4 years agoRevert "[CodeGen] Add support for multiple memory operands in MachineInstr::mayAlias"
Jean-Michel Gorius [Fri, 22 May 2020 19:26:46 +0000 (21:26 +0200)]
Revert "[CodeGen] Add support for multiple memory operands in MachineInstr::mayAlias"

This temporarily reverts commit 7019cea26dfef5882c96f278c32d0f9c49a5e516.

It seems that, for some targets, there are instructions with a lot of memory operands (probably more than would be expected). This causes a lot of buildbots to timeout and notify failed builds. While investigations are ongoing to find out why this happens, revert the changes.

4 years agoRevert "[lldb] Enable C++14 when evaluating expressions in a C++14 frame"
Raphael Isemann [Fri, 22 May 2020 19:23:03 +0000 (21:23 +0200)]
Revert "[lldb] Enable C++14 when evaluating expressions in a C++14 frame"

This reverts commit 5f88f39ab8154682c3b1eb9d7050a9412a55d9e7. It broke these
three tests on the Window bot:
  lldb-api :: commands/expression/completion/TestExprCompletion.py
  lldb-api :: lang/cpp/scope/TestCppScope.py
  lldb-api :: lang/cpp/standards/cpp11/TestCPP11Standard.py

4 years ago[libc++] Make MoveOnly constexpr-friendly
Louis Dionne [Fri, 22 May 2020 15:20:27 +0000 (11:20 -0400)]
[libc++] Make MoveOnly constexpr-friendly

This is necessary when writing constexpr tests.

4 years agoRevert "[analyzer] Change the default output type to PD_TEXT_MINIMAL in the frontend...
Kirstóf Umann [Fri, 22 May 2020 18:18:16 +0000 (20:18 +0200)]
Revert "[analyzer] Change the default output type to PD_TEXT_MINIMAL in the frontend, error if an output loc is missing for PathDiagConsumers that need it"

This reverts commit fe1a3a7e8c8be33968b9a768666489823dabab10.

4 years ago[DSE,MSSA] Add additional multiblock tests.
Florian Hahn [Mon, 27 Apr 2020 14:46:12 +0000 (15:46 +0100)]
[DSE,MSSA] Add additional multiblock tests.

4 years ago[clang-tidy] Expand the list of functions in bugprone-unused-return-value
Joe Ranieri [Fri, 22 May 2020 16:57:58 +0000 (12:57 -0400)]
[clang-tidy] Expand the list of functions in bugprone-unused-return-value

This change adds common C, C++, and POSIX functions to the clang-tidy unused return value checker.

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

4 years ago[lldb/Test] Remove issue_verification subdirectory
Jonas Devlieghere [Fri, 22 May 2020 16:22:53 +0000 (09:22 -0700)]
[lldb/Test] Remove issue_verification subdirectory

These files haven't been touched since 2015. According to Pavel these
were intended to be test for the test framework which never really took
of and are mostly irrelevant by now.

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

4 years ago[VectorCombine] position pass after SLP in the optimization pipeline rather than...
Sanjay Patel [Fri, 22 May 2020 16:13:18 +0000 (12:13 -0400)]
[VectorCombine] position pass after SLP in the optimization pipeline rather than before

There are 2 known problem patterns shown in the test diffs here:
vector horizontal ops (an x86 specialization) and vector reductions.

SLP has greater ability to match and fold those than vector-combine,
so let SLP have first chance at that.

This is a quick fix while we continue to improve vector-combine and
possibly canonicalize to reduction intrinsics.

In the longer term, we should improve matching of these patterns
because if they were created in the "bad" forms shown here, then we
would miss optimizing them.

I'm not sure what is happening with alias analysis on the addsub test.
The old pass manager now shows an extra line for that, and we see an
improvement that comes from SLP vectorizing a store. I don't know
what's missing with the new pass manager to make that happen.
Strangely, I can't reproduce the behavior if I compile from C++ with
clang and invoke the new PM with "-fexperimental-new-pass-manager".

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

4 years ago[RISCV] Register null target streamer for RISC-V
Pengxuan Zheng [Thu, 21 May 2020 02:12:36 +0000 (19:12 -0700)]
[RISCV] Register null target streamer for RISC-V

Summary:
This fixes two llc crashes with the following tests when RISC-V is the default
target.

LLVM :: DebugInfo/Generic/global.ll
LLVM :: DebugInfo/Generic/inlined-strings.ll

Reviewers: HsiangKai

Reviewed By: HsiangKai

Subscribers: hiraditya, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, lenary, s.egerton, sameer.abuasal, apazos, luismarques, evandro, llvm-commits

Tags: #llvm

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

4 years ago[analyzer] SATestBuild.py: Fix hang when one of the tasks fails
Valeriy Savchenko [Fri, 22 May 2020 15:47:04 +0000 (18:47 +0300)]
[analyzer] SATestBuild.py: Fix hang when one of the tasks fails

Summary:
Tasks can crash with many different exceptions including SystemExit.
Bare except still causes a warning, so let's use BaseException instead.

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

4 years ago[CGP] Ensure address offset is representable as int64_t
Simon Pilgrim [Fri, 22 May 2020 15:59:05 +0000 (16:59 +0100)]
[CGP] Ensure address offset is representable as int64_t

AddressingModeMatcher::matchAddr was calling getSExtValue for a constant before ensuring that we can actually represent the value as int64_t

Fixes PR46004 / OSSFuzz#22357

4 years ago[InstCombine] (A + B) + B --> A + (B << 1)
Sanjay Patel [Fri, 22 May 2020 15:37:58 +0000 (11:37 -0400)]
[InstCombine] (A + B) + B --> A + (B << 1)

This eliminates a use of 'B', so it can enable follow-on transforms
as well as improve analysis/codegen.

The PhaseOrdering test was added for D61726, and that shows
the limits of instcombine vs. real reassociation. We would
need to run some form of CSE to collapse that further.

The intermediate variable naming here is intentional because
there's a test at llvm/test/Bitcode/value-with-long-name.ll
that would break with the usual nameless value. I'm not sure
how to improve that test to be more robust.

The naming may also be helpful to debug regressions if this
change exposes weaknesses in the reassociation pass for example.

4 years ago[InstCombine] add tests for adds with common operand; NFC
Sanjay Patel [Fri, 22 May 2020 14:20:43 +0000 (10:20 -0400)]
[InstCombine] add tests for adds with common operand; NFC

4 years ago[SCEV] Constant fold MultExpr before applying depth limit.
Denis Antrushin [Wed, 13 May 2020 17:55:07 +0000 (20:55 +0300)]
[SCEV] Constant fold MultExpr before applying depth limit.

Summary:
Users of SCEV reasonably assume that multiplication of two constant
SCEVs will in turn be constant.
However, that is not always the case:
First, we can get here with reached depth limit, and will create
MultExpr SCEV `C1 * C2` and cache it.
Then, we can get here with the same operands, but with small depth
level. But this time we will find existing MultExpr SCEV and return
it, instead of expected constant SCEV.

This patch changes getMultExpr to not apply depth limit to all constant
operands expression, allowing them to be folded.

Reviewers: reames, mkazantsev

Subscribers: hiraditya, javed.absar, llvm-commits

Tags: #llvm

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

4 years ago[NFC][AIX] Remove spaces after the comma for '.csect' directive
Xiangling_Liao [Fri, 22 May 2020 12:20:35 +0000 (08:20 -0400)]
[NFC][AIX] Remove spaces after the comma for '.csect' directive

To be consistent with other directives like '.comm', '.lcomm', we remove
the spaces after the comma for '.csect' on AIX.

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

4 years agoAMDGPU/GlobalISel: Fix masked control flow with fallthrough blocks
Matt Arsenault [Sun, 17 May 2020 14:51:22 +0000 (10:51 -0400)]
AMDGPU/GlobalISel: Fix masked control flow with fallthrough blocks

Unlike SelectionDAGBuilder, IRTranslator omits the unconditional
branch in fallthrough cases. Confusingly, the control flow pseudos
function in the opposite way the intrinsics are used, and the branch
targets always need to be swapped. We're inverting the target blocks,
so we need to figure out the old fallthrough block and insert a branch
to the original unconditional branch target.

4 years ago[PhaseOrdering] regenerate test checks; NFC
Sanjay Patel [Fri, 22 May 2020 13:54:00 +0000 (09:54 -0400)]
[PhaseOrdering] regenerate test checks; NFC

Remove some redundant/unnecessary bits too.

4 years agoTitle: [LV] Handle Fold-Tail of loops with vectorizarion factor equal to 1
Anh Tuyen Tran [Fri, 22 May 2020 13:30:56 +0000 (13:30 +0000)]
Title: [LV] Handle Fold-Tail of loops with vectorizarion factor equal to 1

Summary:
When handling loops whose VF is 1, fold-tail vectorization sets the
backedge taken count of the original loop with a vector of a single
element. This causes type-mismatch during instruction generartion.

The purpose of this patch is toto address the case of VF==1.

Reviewer: Ayal (Ayal Zaks), bmahjour (Bardia Mahjour), fhahn (Florian Hahn), gilr (Gil Rapaport), rengolin (Renato Golin)

Reviewed By: Ayal (Ayal Zaks), bmahjour (Bardia Mahjour), fhahn (Florian Hahn)

Subscribers: Ayal (Ayal Zaks), rkruppe (Hanna Kruppe), bmahjour (Bardia Mahjour), rogfer01 (Roger Ferrer Ibanez), vkmr (Vineet Kumar), bollu (Siddharth Bhat), hiraditya (Aditya Kumar), llvm-commits (Mailing List llvm-commits)

Tag: LLVM

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

4 years agoTargetLowering.h - remove unnecessary includes. NFC.
Simon Pilgrim [Fri, 22 May 2020 13:22:56 +0000 (14:22 +0100)]
TargetLowering.h - remove unnecessary includes. NFC.

Replace with forward declarations and move SizeOpts.h down to TargetLoweringBase.cpp

4 years ago[TargetLowering] Move TargetLoweringBase::isJumpTableRelative() implementation into...
Simon Pilgrim [Fri, 22 May 2020 12:18:06 +0000 (13:18 +0100)]
[TargetLowering] Move TargetLoweringBase::isJumpTableRelative() implementation into TargetLoweringBase.cpp. NFC.

This will help with reducing header dependencies in TargetLowering.h in a future patch.

4 years ago[libc++] NFC: Inline array<T,N>::at methods inside the class
Louis Dionne [Fri, 22 May 2020 13:23:32 +0000 (09:23 -0400)]
[libc++] NFC: Inline array<T,N>::at methods inside the class

All other methods are defined in the class, so this increases consistency.

4 years ago[SLP] fix verification check for valid IR
Sanjay Patel [Fri, 22 May 2020 13:12:06 +0000 (09:12 -0400)]
[SLP] fix verification check for valid IR

This is a fix for PR45965 - https://bugs.llvm.org/show_bug.cgi?id=45965 -
which was left out of D80106 because of a test failure.

SLP does its own mini-CSE after potentially creating redundant instructions,
so we need to wait for that to complete before running the verifier.
Otherwise, we will see a test failure for
test/Transforms/SLPVectorizer/X86/crash_vectorizeTree.ll (not changed here)
because a phi temporarily has identical but different incoming values for
the same incoming block.

A related, but independent, test that would have been altered here was
fixed with:
rG880df55

The test was escaping verification in SLP without this change because we
were not running verifyFunction() unless SLP actually changed the IR.

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

4 years ago[analyzer] LoopUnrolling: fix crash when a parameter is a loop counter.
Artem Dergachev [Fri, 22 May 2020 11:53:59 +0000 (14:53 +0300)]
[analyzer] LoopUnrolling: fix crash when a parameter is a loop counter.

When loop counter is a function parameter "isPossiblyEscaped" will not find
the variable declaration which lead to hitting "llvm_unreachable".
Parameters of reference type should be escaped like global variables;
otherwise treat them as unescaped.

Patch by Abbas Sabra!

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

4 years ago[SLP] fix test to have valid IR; NFC
Sanjay Patel [Fri, 22 May 2020 12:39:22 +0000 (08:39 -0400)]
[SLP] fix test to have valid IR; NFC

This test was failing verification because the
metadata is ill-formed. This commit is split
from D80401 because it is an independent fix
(although the test would break with that change).

4 years ago[PowerPC] Treat 'Z' inline asm constraint as a true memory constraint
Nemanja Ivanovic [Fri, 22 May 2020 12:59:12 +0000 (07:59 -0500)]
[PowerPC] Treat 'Z' inline asm constraint as a true memory constraint

We currently emit incorrect codegen for this constraint because we set it as a
constraint that allows registers. This will cause the value to be copied to the
stack and that address to be passed as the address. This is not what we want.

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

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

4 years ago[PowerPC] Add missing handling for half precision
Nemanja Ivanovic [Fri, 22 May 2020 12:48:09 +0000 (07:48 -0500)]
[PowerPC] Add missing handling for half precision

The fix for PR39865 took care of some of the handling for half precision
but it missed a number of issues that still exist. This patch fixes the
remaining issues that cause crashes in the PPC back end.

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

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