platform/upstream/llvm.git
4 years ago[InstCombine] Support vectors in SimplifyAddWithRemainder.
Florian Hahn [Tue, 10 Mar 2020 14:22:19 +0000 (14:22 +0000)]
[InstCombine] Support vectors in SimplifyAddWithRemainder.

SimplifyAddWithRemainder currently also matches for vector types, but
tries to create an integer constant, which causes a crash.

By using Constant::getIntegerValue() we can support both the scalar and
vector cases.

The 2 added test cases crash without the fix.

Reviewers: spatel, lebedev.ri

Reviewed By: spatel, lebedev.ri

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

4 years agoRevert "[clang-tidy] New check: bugprone-suspicious-include"
Nico Weber [Tue, 10 Mar 2020 14:27:57 +0000 (10:27 -0400)]
Revert "[clang-tidy] New check: bugprone-suspicious-include"

This reverts commit 1e0669bfe05f0f48ee88152c4a1d581f484f8d67
(and follow-ups 698a12712920c214e39bb215fe26fad2e099425b and
52bbdad7d63fd060d102b3591b433d116a982255).
The tests fail fail on Windows, see https://reviews.llvm.org/D74669

4 years ago[gn build] (manually) merge 47edf5bafb
Nico Weber [Tue, 10 Mar 2020 14:22:39 +0000 (10:22 -0400)]
[gn build] (manually) merge 47edf5bafb

4 years ago[ARM,CDE] Generalize MVE intrinsics infrastructure to support CDE
Mikhail Maltsev [Tue, 10 Mar 2020 14:01:42 +0000 (14:01 +0000)]
[ARM,CDE] Generalize MVE intrinsics infrastructure to support CDE

Summary:
This patch generalizes the existing code to support CDE intrinsics
which will share some properties with existing MVE intrinsics
(some of the intrinsics will be polymorphic and accept/return values
of MVE vector types).
Specifically the patch:
* Adds new tablegen backends -gen-arm-cde-builtin-def,
  -gen-arm-cde-builtin-codegen, -gen-arm-cde-builtin-sema,
  -gen-arm-cde-builtin-aliases, -gen-arm-cde-builtin-header based on
  existing MVE backends.
* Renames the '__clang_arm_mve_alias' attribute into
  '__clang_arm_builtin_alias' (it will be used with CDE intrinsics as
  well as MVE intrinsics)
* Implements semantic checks for the coprocessor argument of the CDE
  intrinsics as well as the existing coprocessor intrinsics.
* Adds one CDE intrinsic __arm_cx1 to test the above changes

Reviewers: simon_tatham, MarkMurrayARM, ostannard, dmgreen

Reviewed By: simon_tatham

Subscribers: sdesmalen, mgorny, kristof.beyls, danielkiss, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

4 years ago[SimplifyCFG] Skip merging return blocks if it would break a CallBr.
Jonas Paulsson [Wed, 4 Mar 2020 16:11:40 +0000 (17:11 +0100)]
[SimplifyCFG]  Skip merging return blocks if it would break a CallBr.

SimplifyCFG should not merge empty return blocks and leave a CallBr behind
with a duplicated destination since the verifier will then trigger an
assert. This patch checks for this case and avoids the transformation.

CodeGenPrepare has a similar check which also has a FIXME comment about why
this is needed. It seems perhaps better if these two passes would eventually
instead update the CallBr instruction instead of just checking and avoiding.

This fixes https://bugs.llvm.org/show_bug.cgi?id=45062.

Review: Craig Topper

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

4 years ago[InstCombine] regenerate test checks; NFC
Sanjay Patel [Tue, 10 Mar 2020 13:56:38 +0000 (09:56 -0400)]
[InstCombine] regenerate test checks; NFC

tmp -> t because 'tmp' tends to cause problems for the auto-generation script.

4 years ago[TargetLowering] SimplifyDemandedVectorElts - add DemandedElts mask to ISD::BITCAST...
Simon Pilgrim [Tue, 10 Mar 2020 13:38:33 +0000 (13:38 +0000)]
[TargetLowering] SimplifyDemandedVectorElts - add DemandedElts mask to ISD::BITCAST SimplifyDemandedBits call.

This fixes most of the regressions introduced in the rG4bc6f6332028 bugfix. The vector-trunc.ll issue should be fixed by D66004.

4 years ago[lldb] Improve test failure messages in vscode tests
Pavel Labath [Tue, 10 Mar 2020 13:31:03 +0000 (14:31 +0100)]
[lldb] Improve test failure messages in vscode tests

A couple of tests sporadically fail on these assertions, but the error
messages do not give a clue as to what has actually happened.

Improve them so that we can better understand what is going wrong.

4 years ago[InstCombine] fold gep-of-select-of-constants (PR45084)
Sanjay Patel [Mon, 9 Mar 2020 21:24:11 +0000 (17:24 -0400)]
[InstCombine] fold gep-of-select-of-constants (PR45084)

As shown in:
https://bugs.llvm.org/show_bug.cgi?id=45084
...we failed to combine a gep with constant indexes with a
pointer operand that is a select of constants.

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

4 years ago[InstCombine] add/adjust tests for select-gep; NFC
Sanjay Patel [Sun, 8 Mar 2020 14:45:14 +0000 (10:45 -0400)]
[InstCombine] add/adjust tests for select-gep; NFC

Goes with D75807

4 years ago[SLP] Support vectorizing functions provided by vector libs.
Florian Hahn [Tue, 10 Mar 2020 13:03:43 +0000 (13:03 +0000)]
[SLP] Support vectorizing functions provided by vector libs.

It seems like the SLPVectorizer is currently not aware of vector
versions of functions provided by libraries like Accelerate [1].
This patch updates SLPVectorizer to use the same infrastructure
the LoopVectorizer uses to detect vectorizable library functions.

For calls, it computes the cost of an intrinsic call (existing behavior)
and the cost of a vector function library call, if available. Like
LoopVectorizer, it assumes the cost of the vector function is simply the
cost of a call to a vector function.

[1] https://developer.apple.com/documentation/accelerate

Reviewers: ABataev, RKSimon, spatel

Reviewed By: ABataev

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

4 years ago[lldb] Break up CommandObjectDisassemble::DoExecute
Pavel Labath [Mon, 9 Mar 2020 15:22:43 +0000 (16:22 +0100)]
[lldb] Break up CommandObjectDisassemble::DoExecute

The function consisted of a complicated set of conditions to compute the
address ranges which are to be disassembled (depending on the mode
selected by command line switches). This patch creates a separate
function for each mode, so that DoExecute is only left with the task of
figuring out how to dump the relevant ranges.

This is NFC-ish, except for one change in the error message, which is
actually an improvement.

4 years ago[lldb] Make UnwindLLDB a non-plugin
Pavel Labath [Mon, 9 Mar 2020 13:36:15 +0000 (14:36 +0100)]
[lldb] Make UnwindLLDB a non-plugin

Summary:
This is the only real unwinder, and things have been this way for quite
a long time. At this point, the class has accumulated so many features
it is unlikely that anyone will want to reimplement the whole thing.

The class is also fairly closely coupled (through UnwindPlans and
FuncUnwinders) with a lot of other lldb components that it is hard to
imagine a different unwinder implementation being substantially
different without reimplementing all of those.

The existing unwinding functionality is nonetheless fairly complex and
there is space for adding more structure to it, but I believe a more
worthwhile effort would be to take the existing UnwindLLDB class and try
to break it down and introduce extension/customization points, instead
of writing a brand new Unwind implementation.

Reviewers: jasonmolenda, JDevlieghere, xiaobai

Subscribers: mgorny, lldb-commits

Tags: #lldb

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

4 years ago[NFC] Tweak OptionsUtils
Nathan James [Tue, 10 Mar 2020 12:50:58 +0000 (12:50 +0000)]
[NFC] Tweak OptionsUtils

4 years ago[LLD] Add support for --unique option
David Bozier [Mon, 9 Mar 2020 15:43:20 +0000 (15:43 +0000)]
[LLD] Add support for --unique option

Summary:
Places orphan sections into a unique output section. This prevents the merging of orphan sections of the same name.
Matches behaviour of GNU ld --unique. --unique=pattern is not implemented.

Motivated user case shown in the test has 2 local symbols as they would appear if C++ source has been compiled with -ffunction-sections. The merging of these sections in the case of a partial link (-r) may limit the effectiveness of -gc-sections of a subsequent link.

Reviewers: espindola, jhenderson, bd1976llvm, edd, andrewng, JonChesterfield, MaskRay, grimar, ruiu, psmith

Reviewed By: MaskRay, grimar

Subscribers: emaste, arichardson, MaskRay, llvm-commits

Tags: #llvm

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

4 years ago[X86][SSE] Add more accurate costs for fmaxnum/fminnum codegen
Simon Pilgrim [Tue, 10 Mar 2020 11:59:23 +0000 (11:59 +0000)]
[X86][SSE] Add more accurate costs for fmaxnum/fminnum codegen

Based off llvm-mca reports on codegen in llvm\test\CodeGen\X86\fmaxnum.ll + llvm\test\CodeGen\X86\fminnum.ll

4 years ago[NFC][llvm-dwarfdump] Always use 'const Twine &'
Djordje Todorovic [Tue, 10 Mar 2020 11:06:08 +0000 (12:06 +0100)]
[NFC][llvm-dwarfdump] Always use 'const Twine &'

According to the Twine.h comment, the Twines should only
be used as const references in arguments.

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

4 years ago[SLPVectorizer][X86] Add fmaxnum/fminnum tests
Simon Pilgrim [Tue, 10 Mar 2020 11:18:10 +0000 (11:18 +0000)]
[SLPVectorizer][X86] Add fmaxnum/fminnum tests

4 years ago[CostModel][X86] Add fmaxnum/fminnum costs tests
Simon Pilgrim [Tue, 10 Mar 2020 11:00:07 +0000 (11:00 +0000)]
[CostModel][X86] Add fmaxnum/fminnum costs tests

4 years ago[X86][SSE] Add SSE41 coverage for fmaxnum/fminnum tests
Simon Pilgrim [Tue, 10 Mar 2020 10:58:45 +0000 (10:58 +0000)]
[X86][SSE] Add SSE41 coverage for fmaxnum/fminnum tests

4 years ago [AMDGPU] SI_INDIRECT_DST_V* pseudos expansion should place EXEC restore to separate...
alex-t [Tue, 10 Mar 2020 10:59:11 +0000 (13:59 +0300)]
 [AMDGPU] SI_INDIRECT_DST_V* pseudos expansion should place EXEC restore to separate basic block

Summary:
When SI_INDIRECT_DST_V* pseudos has indexes in VGPR, they get expanded into the self-looped basic block that modifies EXEC in a loop.

To keep EXEC consistent it is stored before and then re-stored after the pseudo expansion result.

%95:vreg_512 = SI_INDIRECT_DST_V16 %93:vreg_512(tied-def 0), %94:sreg_32, 0, killed %1500:vgpr_32

results to

    s_mov_b64 s[6:7], exec
BB0_16:
    v_readfirstlane_b32 s8, v28
    v_cmp_eq_u32_e32 vcc, s8, v28
    s_and_saveexec_b64 vcc, vcc
    s_set_gpr_idx_on s8, gpr_idx(DST)
    v_mov_b32_e32 v6, v25
    s_set_gpr_idx_off
    s_xor_b64 exec, exec, vcc
    s_cbranch_execnz BB0_16
; %bb.17:
    s_mov_b64 exec, s[6:7]

The bug appeared in case this expansion occurs in the ELSE block of the CF.

Originally

  %110:vreg_512 = SI_INDIRECT_DST_V16 %103:vreg_512(tied-def 0), %85:vgpr_32, 0, %107:vgpr_32,
   %112:sreg_64 = SI_ELSE %108:sreg_64, %bb.19, 0, implicit-def dead $exec, implicit-def dead $scc, implicit $exec

expanded to

         ******************   <== here exec has "THEN" context

    s_mov_b64 s[6:7], exec
BB0_16:
    v_readfirstlane_b32 s8, v28
    v_cmp_eq_u32_e32 vcc, s8, v28
    s_and_saveexec_b64 vcc, vcc
    s_set_gpr_idx_on s8, gpr_idx(DST)
    v_mov_b32_e32 v6, v25
    s_set_gpr_idx_off
    s_xor_b64 exec, exec, vcc
    s_cbranch_execnz BB0_16
; %bb.17:
    s_or_saveexec_b64 s[4:5], s[4:5]   <-- exec mask is restored for "ELSE" but immediately overwritten.
    s_mov_b64 exec, s[6:7]

The rest of the "ELSE" block is executed not by the workitems which constitute the "else mask" but by those which constitute "then mask"

SILowerControlFlow::emitElse always considers the basic block begin() as an insertion point for s_or_saveexec.

Proposed fix:  The SI_INDIRECT_DST_V* procedure should split the reminder block to create landing pad for the EXEC restoration.

Reviewers: rampitec, vpykhtin, nhaehnle

Reviewed By: vpykhtin

Subscribers: arsenm, kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[AArch64][SVE] Add SVE intrinsics for address calculations
Kerry McLaughlin [Tue, 10 Mar 2020 10:40:10 +0000 (10:40 +0000)]
[AArch64][SVE] Add SVE intrinsics for address calculations

Summary: Adds the @llvm.aarch64.sve.adr[b|h|w|d] intrinsics

Reviewers: sdesmalen, andwar, efriedma, dancgr, cameron.mcinally, rengolin

Reviewed By: sdesmalen

Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, danielkiss, cfe-commits, llvm-commits

Tags: #llvm

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

4 years ago[Arm] Do not lower vmax/vmin to Neon instructions
James Greenhalgh [Tue, 10 Mar 2020 10:16:12 +0000 (10:16 +0000)]
[Arm] Do not lower vmax/vmin to Neon instructions

On some Arm cores there is a performance penalty when forwarding from an
S register to a D register.  Calculating VMAX in a D register creates
false forwarding hazards, so don't do that unless we're on a core which
specifically asks for it.

Patch by James Greenhalgh

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

4 years ago[X86][AVX] combineX86ShuffleChain - combine binary shuffles to X86ISD::VPERM2X128
Simon Pilgrim [Tue, 10 Mar 2020 10:44:12 +0000 (10:44 +0000)]
[X86][AVX] combineX86ShuffleChain - combine binary shuffles to X86ISD::VPERM2X128

For pre-AVX512 targets, combine binary shuffles to X86ISD::VPERM2X128 if possible. This mainly helps optimize the blend(extract_subvector(x,1),y) pattern.

At some point soon we're going to have make a decision about when to combine AVX512 shuffles more aggressively - we bail out if there is any change in element size (to protect predicate mask merging) which means we miss out on a lot of optimizations.

4 years ago[Analyzer][NFC] Change parameter of NoteTag lambdas to PathSensitiveBugReport
Adam Balogh [Tue, 10 Mar 2020 08:05:16 +0000 (09:05 +0100)]
[Analyzer][NFC] Change parameter of NoteTag lambdas to PathSensitiveBugReport

Lambdas creating path notes using NoteTags still take BugReport as their
parameter. Since path notes obviously only appear in PathSensitiveBugReports
it is straightforward that lambdas of NoteTags take PathSensitiveBugReport
as their parameter.

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

4 years ago[ExpandMemCmp][NFC] Add more tests.
Clement Courbet [Tue, 10 Mar 2020 10:31:00 +0000 (11:31 +0100)]
[ExpandMemCmp][NFC] Add more tests.

4 years ago[SLP] Precommit vector library test for D75878.
Florian Hahn [Tue, 10 Mar 2020 10:16:35 +0000 (10:16 +0000)]
[SLP] Precommit vector library test for D75878.

4 years ago[ARM][MVE] Validate tail predication values
Sam Parker [Tue, 10 Mar 2020 09:58:29 +0000 (09:58 +0000)]
[ARM][MVE] Validate tail predication values

Iterate through the loop and check that the observable values
produced are the same whether tail predication happens or not.

We want to find out if the tail-predicated version of this loop will
produce the same values as the loop in its original form. For this to
be true, the newly inserted implicit predication must not change the
the (observable) results.

We're doing this because many instructions in the loop will not be
predicated and so the conversion from VPT predication to tail
predication can result in different values being produced, because of
falsely predicated lanes not being updated in the converted form.

A masked load, whether through VPT or tail predication, will write
zeros to any of the falsely predicated bytes. So, from the loads, we
know that the false lanes are zeroed and here we're trying to track
that those false lanes remain zero, or where they change, the
differences are masked away by their user(s).

All MVE loads and stores have to be predicated, so we know that any
load operands, or stored results are equivalent already. Other
explicitly predicated instructions will perform the same operation in
the original loop and the tail-predicated form too. Because of this,
we can insert loads, stores and other predicated instructions into
our KnownFalseZeros set and build from there.

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

4 years ago[clang-format] Correct indentation for `[key] = value,` entries in C# object initialisers
Jonathan Coe [Tue, 10 Mar 2020 09:33:39 +0000 (09:33 +0000)]
[clang-format] Correct indentation for `[key] = value,` entries in C# object initialisers

Restores content of commit cb3f20d27c9e91cb9f997f0401f388e62c4ba993
reverted in commit 5a101f377315c0c0c58e8df842fe5eb5d8c7611d
with a corrected commit message.

Summary: Do not use continuation indent for '[' in blocks in C# code.

Reviewers: krasimir

Reviewed By: krasimir

Subscribers: cfe-commits

Tags: #clang-format, #clang

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

4 years agoRevert "[clang-format] Correct indentation for `[key] = value,` entries in C++ object...
Jonathan Coe [Tue, 10 Mar 2020 09:30:34 +0000 (09:30 +0000)]
Revert "[clang-format] Correct indentation for `[key] = value,` entries in C++ object initialisers"

Commit message says "C++" where it should say "C#".

This reverts commit cb3f20d27c9e91cb9f997f0401f388e62c4ba993.

4 years agoReland "[DebugInfo] Enable the debug entry values feature by default"
Djordje Todorovic [Mon, 9 Mar 2020 11:43:38 +0000 (12:43 +0100)]
Reland "[DebugInfo] Enable the debug entry values feature by default"

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

4 years agotsan: tsan_interface.h: make constants static
Dmitry Vyukov [Tue, 10 Mar 2020 08:12:28 +0000 (09:12 +0100)]
tsan: tsan_interface.h: make constants static

Note that in C++ the static keyword is implicit for const objects.
In C however it is not, and we get clashes at link time after
including the header from more than one C file:

lib.a(bar.o):(.rodata+0x0): multiple definition of `__tsan_mutex_linker_init'
lib.a(foo.o):(.rodata+0x0): first defined here
lib.a(bar.o):(.rodata+0xc): multiple definition of `__tsan_mutex_not_static'
lib.a(foo.o):(.rodata+0xc): first defined here
<snip>
Indeed both foo.o and bar.o define the clashing symbols:

$ nm foo.o
<snip>
0000000000000000 R __tsan_mutex_linker_init
000000000000000c R __tsan_mutex_not_static
<snip>
Fix it by explicitly making the constants static.

Reviewed-in: https://reviews.llvm.org/D75820
Author: cota (Emilio G. Cota)

4 years ago[X86] Remove isel patterns for (X86VBroadcast (i16 (trunc (i32 (load))))). Replace...
Craig Topper [Tue, 10 Mar 2020 07:00:26 +0000 (00:00 -0700)]
[X86] Remove isel patterns for (X86VBroadcast (i16 (trunc (i32 (load))))). Replace with a DAG combine to form VBROADCAST_LOAD.

isTypeDesirableForOp prevents loads from being shrunk to i16 by DAG
combine. Because of this we can't just match the broadcast and a
scalar load. So look for broadcast+truncate+load and form a
vbroadcast_load during DAG combine. This replaces what was
previously done as an isel pattern and I think fixes it so we
won't change the size of a volatile load. But my main motivation
is just to clean up our isel patterns.

4 years ago[llvm][MIRVRegNamer] Avoid collisions across constant pool indices.
Puyan Lotfi [Tue, 10 Mar 2020 04:31:01 +0000 (00:31 -0400)]
[llvm][MIRVRegNamer] Avoid collisions across constant pool indices.

When hashing on MachineOperand::MO_ConstantPoolIndex, now MIR-Canon and
MIRVRegNamer will no longer result in a hash collision.

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

4 years ago[libc] Add simple implementations of mtx_lock and mtx_unlock.
Siva Chandra Reddy [Mon, 10 Feb 2020 07:33:38 +0000 (23:33 -0800)]
[libc] Add simple implementations of mtx_lock and mtx_unlock.

These functions only support locking and unlocking of plain mutexes.
They will be extended in future changes to handled recursive and timed
mutexes.

Reviewers: phosek

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

4 years ago[libc] Take 2: Add linux implementations of thrd_create and thrd_join functions.
Siva Chandra Reddy [Fri, 6 Mar 2020 23:05:50 +0000 (15:05 -0800)]
[libc] Take 2: Add linux implementations of thrd_create and thrd_join functions.

The following are the differences from the first version:

1. The kernel does not copy the stack for the new thread (it cannot).
The previous version missed this fact. In this new version, the new
thread's start args are copied on to the new stack in a known location
so that the new thread can sniff them out.
2. A start args sniffer for x86_64 has been added.
2. Default stack size has been increased to 64KB.

Reviewers: abrachet, phosek

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

4 years agoFix MLIR build when NVPTX backend is not configured in
Mehdi Amini [Tue, 10 Mar 2020 04:09:33 +0000 (04:09 +0000)]
Fix MLIR build when NVPTX backend is not configured in

The GPUToCUDA conversion needs to conditionally link it
in.

4 years agoAMDGPU/GlobalISel: Avoid illegal vector exts for add/sub/mul
Matt Arsenault [Wed, 19 Feb 2020 17:54:35 +0000 (12:54 -0500)]
AMDGPU/GlobalISel: Avoid illegal vector exts for add/sub/mul

When expanding scalar packed operations, we should not introduce
illegal vector casts LegalizerHelper introduces. We're not in a
legalizer context, and there's no RegBankSelect apply or legalize
worklist.

4 years agoAMDGPU/GlobalISel: Fix mishandling SGPR v2s16 add/sub/mul
Matt Arsenault [Wed, 19 Feb 2020 18:23:11 +0000 (13:23 -0500)]
AMDGPU/GlobalISel: Fix mishandling SGPR v2s16 add/sub/mul

We weren't considering the packed case correctly, and this was passing
through to the selector. The selector only checked the size, so this
would incorrectly compile to a single 32-bit scalar add.

As usual, the LegalizerHelper is somewhat awkward to use from
applyMappingImpl. I think this is the first place we've needed
multi-step legalization here though.

4 years ago[MC] Allow Stackmap sections after DWARF in MachO.
Lang Hames [Mon, 9 Mar 2020 04:41:10 +0000 (21:41 -0700)]
[MC] Allow Stackmap sections after DWARF in MachO.

Summary:
Mixing stackmaps and DWARF in a single file triggers an assertion in
MCMachOStreamer as stackmap sections are emitted in AsmPrinter::emitEndOfAsmFile
after the DWARF sections have already been emitted.

Since it should be safe to emit stackmap sections after DWARF sections this
patch relaxes the assertion to allow that.

Reviewers: aprantl, dblaikie, echristo

Subscribers: hiraditya, ributzka, llvm-commits

Tags: #llvm

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

4 years ago[mlir] NFC: remove IntegerValueSet / MutableIntegerSet
Uday Bondhugula [Tue, 10 Mar 2020 00:48:28 +0000 (20:48 -0400)]
[mlir] NFC: remove IntegerValueSet / MutableIntegerSet

Summary:
- these are unused and really not needed now given flat affine
  constraints

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

4 years ago[NFC] use hasAnyOperatorName and hasAnyOverloadedOperatorName functions in clang...
Nathan James [Tue, 10 Mar 2020 00:42:21 +0000 (00:42 +0000)]
[NFC] use hasAnyOperatorName and hasAnyOverloadedOperatorName functions in clang-tidy matchers

4 years ago[WebAssembly] Fixed FrameBaseLocal not being set.
Wouter van Oortmerssen [Tue, 10 Mar 2020 00:24:46 +0000 (17:24 -0700)]
[WebAssembly] Fixed FrameBaseLocal not being set.

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

WebAssemblyRegColoring may merge the vreg that currently represents
the FrameBase with one representing an argument.
WebAssemblyExplicitLocals picks up the corresponding local when
a vreg is first added to the Reg2Local mapping, except when it is
an argument instruction which are handled separately.

Note that this does not change that vregs representing the FrameBase
may get merged, it is not clear to me that this may have other
effects we may want to avoid?

Reviewers: dschuff

Reviewed By: dschuff

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

Tags: #llvm

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

4 years ago[ASTMatchers] Add hasAnyOverloadedOperatorName matcher
Nathan James [Mon, 9 Mar 2020 11:16:50 +0000 (11:16 +0000)]
[ASTMatchers] Add hasAnyOverloadedOperatorName matcher

Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[x86][slh] Move isDataInvariant* functions
George Burgess IV [Tue, 10 Mar 2020 00:04:30 +0000 (17:04 -0700)]
[x86][slh] Move isDataInvariant* functions

Patch by Zola Bridges!

From the review:

"""
I moved these functions to X86InstrInfo.cpp, so they are available from
another pass. In addition, this is a step toward resolving the FIXME to
move this metadata to the instruction tables.

This is the final step to make these two data invariance checks
available for non-SLH passes.

The other two steps were here:

- https://reviews.llvm.org/D70283
- https://reviews.llvm.org/D75650

Tested via llvm-lit llvm/test/CodeGen/X86/speculative-load-hardening*
"""

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

4 years ago[x86][slh][NFC] Rm redundant liveness check
George Burgess IV [Tue, 10 Mar 2020 00:02:51 +0000 (17:02 -0700)]
[x86][slh][NFC] Rm redundant liveness check

Patch by Zola Bridges!

From the review:

"""
In this changeset (https://reviews.llvm.org/D70283), I added a liveness
check everywhere the isDataInvariant* functions were used, so that I
could safely delete the checks within the function. I mistakenly left
that deletion out of the patch. The result is that the same condition is
checked twice for some instructions which is functionally fine, but not
good. This change deletes the redundant check that I intended to delete
in the last change.

This is the second of three patches that will make the data invariance
checks available for non-SLH passes and enable the FIXMEs related to
moving this metadata to the instruction tables to be resolved.

Tested via llvm-lit llvm/test/CodeGen/X86/speculative-load-hardening*
"""

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

4 years agoRevert "PR45083: Mark statement expressions as being dependent if they contain"
Richard Smith [Tue, 10 Mar 2020 00:03:56 +0000 (17:03 -0700)]
Revert "PR45083: Mark statement expressions as being dependent if they contain"

This reverts commit 2669e41b7b9c1561a01048d5ed0aba3c62432dfc, which was
pushed by mistake.

4 years agoMark test function as 'weak' to prevent interprocedural CSE.
Richard Smith [Tue, 10 Mar 2020 00:01:07 +0000 (17:01 -0700)]
Mark test function as 'weak' to prevent interprocedural CSE.

A recent change to MemorySSA caused LLVM to start optimizing the call to
'f(x)' into just 'x', despite the 'noinline' attribute. So try harder to
prevent this optimization from firing.

4 years agoPR45083: Mark statement expressions as being dependent if they contain
Richard Smith [Thu, 5 Mar 2020 20:20:02 +0000 (12:20 -0800)]
PR45083: Mark statement expressions as being dependent if they contain
dependent constructs.

We previously assumed they were neither value- nor
instantiation-dependent under any circumstances, which would lead to
crashes and other misbehavior.

This doesn't match GCC's behavior (where statement expressions appear to
be treated as value-dependent if they appear in a dependent context),
but seems to be the best thing we can do in the short term: it turns out
to be remarkably difficult for us to correctly determine whether we are
in a dependent context (and it's not even possible in some cases, such
as in a generic lambda where we might not have seen the 'auto' yet).

This was previously reverted in 8e4a867 for rejecting some code, but that
code was invalid and Clang was previously incorrectly accepting it.

4 years ago[ASan] Enable set_shadow_test.c on Windows.
Matt Morehouse [Mon, 9 Mar 2020 23:07:45 +0000 (16:07 -0700)]
[ASan] Enable set_shadow_test.c on Windows.

It looks like the recent -fno-common is making it pass now.

4 years ago[mlir][SideEffects] Replace the old SideEffects dialect interface with the newly...
River Riddle [Mon, 9 Mar 2020 23:01:41 +0000 (16:01 -0700)]
[mlir][SideEffects] Replace the old SideEffects dialect interface with the newly added op interfaces/traits.

Summary:
The old interface was a temporary stopgap to allow for implementing simple LICM that took side effects of region operations into account. Now that MLIR has proper support for specifying memory effects, this interface can be deleted.

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

4 years ago[cmake] Strip quotes in compiler-rt/lib/crt; error if checks fail
George Burgess IV [Mon, 9 Mar 2020 22:48:19 +0000 (15:48 -0700)]
[cmake] Strip quotes in compiler-rt/lib/crt; error if checks fail

Patch by Zhizhou Yang!

In his own words:

"""
Similar change to CMakeLists as r372312.

After r372209, compiler command line may include argument with quotes:

```
-fprofile-instr-use="/foo/bar.profdata"
```

And it causes a hidden failure with execute_process later: Could not
read profile "/foo/bar.profdata": No such file or directory.

In this particular case, the check for .init_array will fail silently
and creates a PGO-ed binary with bad .init_array section in compiler-rt.

Bug details can be found in PR45022
"""

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

4 years ago[cmake] By default do not build compiler-rt with PGO
George Burgess IV [Mon, 9 Mar 2020 22:25:41 +0000 (15:25 -0700)]
[cmake] By default do not build compiler-rt with PGO

Patch by Zhizhou Yang!

In his own words:

"""
Currently compiler-rt doesn't officially support either PGO
instrumentation or use PGO profdata to build it.

PGO related flags are passed into compiler-rt since rL372209, and
causing bugs: 45022, crbug:1018840

This patch adds several checks in compiler-rt to disable PGO related
flags and provides a flag to turn on PGO for compiler-rt if needed.
"""

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

4 years ago[clang-tidy][docs] Post-commit feedback on D74669
Jonathan Roelofs [Mon, 9 Mar 2020 22:51:41 +0000 (16:51 -0600)]
[clang-tidy][docs] Post-commit feedback on D74669

4 years agoChange tests to use -S instead of -c to work when an external assembler is used that...
Douglas Yung [Mon, 9 Mar 2020 22:42:20 +0000 (15:42 -0700)]
Change tests to use -S instead of -c to work when an external assembler is used that is not present. NFCI.

Reviewed By: NoQ

Subscribers: Charusso, cfe-commits

Tags: #clang

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

4 years ago[CodeGenObjC] Privatize some ObjC metadata symbols
Erik Pilkington [Mon, 9 Mar 2020 19:17:23 +0000 (12:17 -0700)]
[CodeGenObjC] Privatize some ObjC metadata symbols

Nobody needs these symbols, so there isn't any benefit in including them. This
saves some code-size in Objective-C binaries. Partially reverts:
https://reviews.llvm.org/D61454. rdar://56579760

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

4 years ago[AppleObjCRuntimeV2] Fix a typo. Evalulate -> evaluate.
Davide Italiano [Mon, 9 Mar 2020 22:40:09 +0000 (15:40 -0700)]
[AppleObjCRuntimeV2] Fix a typo. Evalulate -> evaluate.

4 years ago[AppleObjC2RuntimeV2] Remove dead code. NFC.
Davide Italiano [Mon, 9 Mar 2020 22:37:12 +0000 (15:37 -0700)]
[AppleObjC2RuntimeV2] Remove dead code. NFC.

4 years ago[ObjC] Dynamic type resolution logging should go to the types log.
Davide Italiano [Mon, 9 Mar 2020 22:35:24 +0000 (15:35 -0700)]
[ObjC] Dynamic type resolution logging should go to the types log.

4 years ago[tests] Add long nop test coverage for intel platforms
Philip Reames [Mon, 9 Mar 2020 22:28:24 +0000 (15:28 -0700)]
[tests] Add long nop test coverage for intel platforms

4 years agoAdd missing list.rst entry
Jonathan Roelofs [Mon, 9 Mar 2020 22:27:35 +0000 (16:27 -0600)]
Add missing list.rst entry

4 years ago[gn] Use ghash if using clang & LLD together to make PDBs
Reid Kleckner [Fri, 6 Mar 2020 22:41:48 +0000 (14:41 -0800)]
[gn] Use ghash if using clang & LLD together to make PDBs

I noticed my links were a bit slower on Windows than usual.

Reviewed By: thakis

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

4 years agorelease notes: fix new check name
Jonathan Roelofs [Mon, 9 Mar 2020 22:11:35 +0000 (16:11 -0600)]
release notes: fix new check name

4 years ago[gn build] Port 1e0669bfe05
LLVM GN Syncbot [Mon, 9 Mar 2020 21:59:49 +0000 (21:59 +0000)]
[gn build] Port 1e0669bfe05

4 years ago[clang-tidy] New check: bugprone-suspicious-include
Jonathan Roelofs [Wed, 4 Mar 2020 16:55:45 +0000 (09:55 -0700)]
[clang-tidy] New check: bugprone-suspicious-include

Detects and fixes suspicious code like: `#include "foo.cpp"`.

Inspired by: https://twitter.com/lefticus/status/1228458240364687360?s=20

https://reviews.llvm.org/D74669

4 years ago[OPENMP50]Codegen for depobj dependency kind.
Alexey Bataev [Mon, 9 Mar 2020 21:18:19 +0000 (17:18 -0400)]
[OPENMP50]Codegen for depobj dependency kind.

Implemented codegen for depobj modifier in depend clauses.

4 years ago[AMDGPU] Fix scheduling info for terminator SALU instructions
Jay Foad [Fri, 6 Mar 2020 15:35:35 +0000 (15:35 +0000)]
[AMDGPU] Fix scheduling info for terminator SALU instructions

Summary:
Instruction variants like S_MOV_B32_term should have the same SchedRW
class as the base instruction, S_MOV_B32. This probably doesn't make any
difference in practice because as terminators, they'll always be
scheduled at the end of a basic block, but it's simply more correct than
giving them all the default SchedRW class of Write32Bit, which implies a
VALU operation.

Reviewers: rampitec, arsenm, nhaehnle

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

Tags: #llvm

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

4 years agoFix internal links in Kaleidoscope tutorial
Jonathan Roelofs [Mon, 9 Mar 2020 21:07:44 +0000 (15:07 -0600)]
Fix internal links in Kaleidoscope tutorial

4 years agoFollow up of 3d9a0445cce3, clang driver defaulting to -fno-common
Sjoerd Meijer [Mon, 9 Mar 2020 20:39:52 +0000 (20:39 +0000)]
Follow up of 3d9a0445cce3, clang driver defaulting to -fno-common

Attempt to pacify windows bot where this failed:

clang/test/CodeGen/vlt_to_pointer.c

4 years ago[HIP] Fix device stub name
Yaxun (Sam) Liu [Thu, 5 Mar 2020 17:59:33 +0000 (12:59 -0500)]
[HIP] Fix device stub name

HIP emits a device stub function for each kernel in host code.

The HIP debugger requires device stub function to have a different unmangled name as the kernel.

Currently the name of the device stub function is the mangled name with a postfix .stub. However,
this does not work with the HIP debugger since the unmangled name is the same as the kernel.

This patch adds prefix __device__stub__ to the unmangled name of the device stub before mangling,
therefore the device stub function has a valid mangled name which is different than the device kernel
name. The device side kernel name is kept unchanged. kernels with extern "C" also gets the prefix added
to the corresponding device stub function.

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

4 years agoFix typo in gn files
Arthur Eubanks [Mon, 9 Mar 2020 20:02:14 +0000 (13:02 -0700)]
Fix typo in gn files

SKD -> SDK

4 years agoDon't emit pointer to int cast warnings under -Wmicrosoft-cast
Arthur Eubanks [Wed, 4 Mar 2020 21:18:59 +0000 (13:18 -0800)]
Don't emit pointer to int cast warnings under -Wmicrosoft-cast

Summary:
MSVC also warns on this:
$ cat /tmp/a.c
int f(void* p) { return (int) p; }

$ cl /c /tmp/a.c
C:/src/tmp/a.c(1): warning C4311: 'type cast': pointer truncation from
'void *' to 'int'

Warnings originally added in https://reviews.llvm.org/D72231.

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[ObjC][ARC] Don't remove autoreleaseRV/retainRV pairs if the call isn't
ahatanak [Mon, 9 Mar 2020 20:20:58 +0000 (13:20 -0700)]
[ObjC][ARC] Don't remove autoreleaseRV/retainRV pairs if the call isn't
a tail call

Previosly ARC optimizer removed the autoreleaseRV/retainRV pair in the
following code, which caused the object returned by @something to be
placed in the autorelease pool because the call to @something isn't a
tail call:

```
  %call = call i8* @something(...)
  %2 = call i8* @objc_retainAutoreleasedReturnValue(i8* %call)
  %3 = call i8* @objc_autoreleaseReturnValue(i8* %2)
  ret i8* %3
```

Fix the bug by checking whether @something is a tail call.

rdar://problem/59275894

4 years ago[mlir][ods] Fix AnyInteger predicate
Lei Zhang [Mon, 9 Mar 2020 16:29:13 +0000 (16:29 +0000)]
[mlir][ods] Fix AnyInteger predicate

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

4 years agoAMDGPU/GlobalISel: Improve handling of illegal return types
Matt Arsenault [Sat, 22 Feb 2020 15:00:38 +0000 (10:00 -0500)]
AMDGPU/GlobalISel: Improve handling of illegal return types

Most importantly, this fixes ret i8. Also make sure to handle
signext/zeroext for odd types > i32. Some of the corresponding
argument passing fixes also need to be handled.

4 years agoRecommit #2 "[Driver] Default to -fno-common for all targets"
Sjoerd Meijer [Mon, 9 Mar 2020 19:25:24 +0000 (19:25 +0000)]
Recommit #2 "[Driver] Default to -fno-common for all targets"

After a first attempt to fix the test-suite failures, my first recommit
caused the same failures again. I had updated CMakeList.txt files of
tests that needed -fcommon, but it turns out that there are also
Makefiles which are used by some bots, so I've updated these Makefiles
now too.

See the original commit message for more details on this change:
0a9fc9233e172601e26381810d093e02ef410f65

4 years agoAMDGPU: Make signext/zeroext behave more sensibly over > i32
Matt Arsenault [Mon, 24 Feb 2020 20:43:18 +0000 (15:43 -0500)]
AMDGPU: Make signext/zeroext behave more sensibly over > i32

Interpret these as extending to the next multiple of 32-bits. This had
no effect with i48 for example, which is really split into {i32, i16},
which should extend the high part.

4 years ago[lldb] Add .clang-tidy with customization to disable readability-identifier-naming
Fangrui Song [Sat, 7 Mar 2020 17:21:03 +0000 (09:21 -0800)]
[lldb] Add .clang-tidy with customization to disable readability-identifier-naming

Reviewed By: JDevlieghere

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

4 years ago[Hexagon] Refactor handling of circular load/store builtins, NFC
Krzysztof Parzyszek [Mon, 9 Mar 2020 19:38:33 +0000 (14:38 -0500)]
[Hexagon] Refactor handling of circular load/store builtins, NFC

4 years agoPermit attribute 'used' with 'target' multiversioning.
Erich Keane [Mon, 9 Mar 2020 17:15:45 +0000 (10:15 -0700)]
Permit attribute 'used' with 'target' multiversioning.

This adds infrastructure for a multiversioning whitelist, plus adds
'used' to the allowed list with 'target'.  The behavior here mirrors the
implementation in GCC, where 'used' only applies to the single
declaration and doesn't apply to the ifunc or resolver.

This is not being applied to cpu_dispatch and cpu_specific, since the
rules are more complicated for cpu_specific, which emits multiple
symbols. Additionally, the author isn't currently aware of uses in the
wild of this combination, but is aware of a number of target+used
combinations.

4 years agoAMDGPU/GlobalISel: Start matching s_lshlN_add_u32 instructions
Matt Arsenault [Fri, 21 Feb 2020 01:26:41 +0000 (20:26 -0500)]
AMDGPU/GlobalISel: Start matching s_lshlN_add_u32 instructions

Use a hack to only enable this for GlobalISel.

Technically this also works with SelectionDAG, but the divergence
selection isn't reliable enough and a few cases fail, but I have no
desire to spend time writing the manual expansion code for it. The DAG
actually does a better job since it catches using v_add_lshl_u32 in
the mixed SGPR/VGPR cases.

4 years agoFix the type of the capture passed to LambdaIntroducer::addCapture in
Akira Hatanaka [Thu, 5 Mar 2020 02:35:07 +0000 (18:35 -0800)]
Fix the type of the capture passed to LambdaIntroducer::addCapture in
RebuildLambdaScopeInfo

Previously the type of the variable was being passed, which was causing
clang to crash when a non-reference variable was captured by reference
or a reference variable was captured by value by a lambda and a block
nested inside the lambda body was referencing the variable.

Original patch by JF Bastien.

rdar://problem/47550338

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

4 years ago[AArch64][SVE] Add missing fp16 DestructiveInstType tests
Cameron McInally [Mon, 9 Mar 2020 18:29:16 +0000 (13:29 -0500)]
[AArch64][SVE] Add missing fp16 DestructiveInstType tests

These tests should have been added with a5b22b768f5a in D73711.

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

4 years ago[libc++] Enable std::function ABI bug demonstration on Apple Clang too
Louis Dionne [Mon, 9 Mar 2020 19:03:16 +0000 (15:03 -0400)]
[libc++] Enable std::function ABI bug demonstration on Apple Clang too

4 years ago[www] cxx_status: Update Reflection TS to Cologne draft
Hubert Tong [Mon, 9 Mar 2020 18:09:00 +0000 (14:09 -0400)]
[www] cxx_status: Update Reflection TS to Cologne draft

Summary:
As of the 2019 Cologne meeting, according to its minutes (N4826), N4818
is the draft of the Reflection TS.

Reviewers: rsmith, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[www] cxx_status: Update title to mention C++20
Hubert Tong [Mon, 9 Mar 2020 18:17:34 +0000 (14:17 -0400)]
[www] cxx_status: Update title to mention C++20

Summary:
The document covers the Clang implementation status of the "upcoming
C++20 standard". Update the title to match.

Reviewers: rsmith, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[X86][SSE] SimplifyDemandedVectorEltsForTargetNode - reduce vector width of X86ISD...
Simon Pilgrim [Mon, 9 Mar 2020 17:35:37 +0000 (17:35 +0000)]
[X86][SSE] SimplifyDemandedVectorEltsForTargetNode - reduce vector width of X86ISD::BLENDI

If we don't need the upper subvector elements of the BLENDI node then use a smaller vector size.

This causes a couple of minor regressions in insertelement-ones.ll which are more examples of PR26018; given how cheap allones generation is I don't consider that a showstopper, just an annoyance (and there's plenty of other poor codegen cases in that file).

4 years ago[X86] Teach combineToExtendBoolVectorInReg to create opportunities for using broadcas...
Craig Topper [Mon, 9 Mar 2020 17:35:31 +0000 (10:35 -0700)]
[X86] Teach combineToExtendBoolVectorInReg to create opportunities for using broadcast load instructions.

If we're inserting a scalar that is smaller than the element
size of the final VT, the value of the extra bits doesn't matter.

Previously we any_extended in the scalar domain before inserting.

This patch changes this to use a broadcast of the original
scalar type and then a bitcast to the final type. This might
enable the use of a broadcast load.

This recovers regressions from 07d68c24aa19483e44db4336b0935b00a5d69949
and 9fcd212e2f678fdbdf304399a1e58ca490dc54d1 without relying on
alignment of the load.

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

4 years agoTest that volatile load type isn't changed
JF Bastien [Wed, 4 Mar 2020 21:51:35 +0000 (13:51 -0800)]
Test that volatile load type isn't changed

Summary: As discussed in D75505, it's not particularly useful to change the type of a load to/from floating-point/integer because it's followed by a bitcast, and it might lead to surprising code generation. Check that this doesn't generally happen.

Reviewers: lebedev.ri

Subscribers: jkorous, dexonsmith, ributzka, llvm-commits

Tags: #llvm

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

4 years agoDrop HEADER_ per review feedback on D74669
Jonathan Roelofs [Mon, 9 Mar 2020 17:56:10 +0000 (11:56 -0600)]
Drop HEADER_ per review feedback on D74669

4 years ago[clang-format] Correct indentation for `[key] = value,` entries in C++ object initial...
Jonathan Coe [Mon, 9 Mar 2020 18:00:03 +0000 (18:00 +0000)]
[clang-format] Correct indentation for `[key] = value,` entries in C++ object initialisers

Summary: Do not use continuation indent for '[' in blocks in C# code.

Reviewers: krasimir

Reviewed By: krasimir

Subscribers: cfe-commits

Tags: #clang-format, #clang

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

4 years ago[gn build] Port 3486cc014b2
LLVM GN Syncbot [Mon, 9 Mar 2020 17:56:57 +0000 (17:56 +0000)]
[gn build] Port 3486cc014b2

4 years agoAdd test missed in r843a9778fcd5
Jeremy Stenglein [Mon, 9 Mar 2020 17:50:05 +0000 (10:50 -0700)]
Add test missed in r843a9778fcd5

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

4 years ago[InstSimplify] Simplify calls with "returned" attribute
Nikita Popov [Sat, 7 Mar 2020 15:34:34 +0000 (16:34 +0100)]
[InstSimplify] Simplify calls with "returned" attribute

If a call argument has the "returned" attribute, we can simplify
the call to the value of that argument. The "-inst-simplify" pass
already handled this for the constant integer argument case via
known bits, which is invoked in SimplifyInstruction. However,
non-constant (or non-int) arguments are not handled at all right now.

This addresses one of the regressions from D75801.

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

4 years agoFix indentation using clang-format for Spiller.h. NFC
Marcello Maggioni [Sun, 8 Mar 2020 17:55:21 +0000 (10:55 -0700)]
Fix indentation using clang-format for Spiller.h. NFC
Spiller.h had indentation that doesn't match LLVM guidelines. Fixing it

Reviewers: qcolombet, arsenm

Subscribers: MatzeB, wdng, hiraditya, llvm-commits, qcolombet

Tags: #llvm

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

4 years agoMove Spiller.h from lib/ directory path to include/CodeGen. NFC
Marcello Maggioni [Sun, 8 Mar 2020 16:36:29 +0000 (09:36 -0700)]
Move Spiller.h from lib/ directory path to include/CodeGen. NFC

This allows Spiller.h to be used and included outside of
the lib/CodeGen directory. For example to be used in the
lib/Target directory or other places.

4 years ago[InstCombine] Don't simplify calls without uses
Nikita Popov [Sat, 7 Mar 2020 19:21:09 +0000 (20:21 +0100)]
[InstCombine] Don't simplify calls without uses

When simplifying a call without uses, replaceInstUsesWith() is
going to do nothing, but we'll skip all following folds. We can
only run into this problem with calls that both simplify and are
not trivially dead if unused, which currently seems to happen only
with calls to undef, as the test diff shows. When extending
SimplifyCall() to handle "returned" attributes, this becomes a much
bigger problem, so I'm fixing this first.

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

4 years ago[InstSimplify] Don't simplify musttail calls
Nikita Popov [Sun, 8 Mar 2020 12:11:46 +0000 (13:11 +0100)]
[InstSimplify] Don't simplify musttail calls

As pointed out by jdoerfert on D75815, we must be careful when
simplifying musttail calls: We can only replace the return value
if we can eliminate the call entirely. As we can't make this
guarantee for all consumers of InstSimplify, this patch disables
simplification of musttail calls. Without this patch, musttail
simplification currently results in module verification errors.

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

4 years agoAdd a warning for builtin_return_address/frame_address with > 0 argument
Jeremy Stenglein [Mon, 9 Mar 2020 17:17:15 +0000 (10:17 -0700)]
Add a warning for builtin_return_address/frame_address with > 0 argument

Clang is missing a warning for
builtin_return_address/builtin_frame_address called with > 0 argument.
Gcc provides a warning for this via -Wframe-address:

https://gcc.gnu.org/onlinedocs/gcc/Return-Address.html

As calling these functions with argument > 0 has caused several crashes
for us, we would like to have the same warning as gcc here. This diff
adds the warning and makes it part of -Wmost.

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

4 years ago[clang-format] C# does not indent braced initializers as continuations
Jonathan Coe [Mon, 9 Mar 2020 17:33:53 +0000 (17:33 +0000)]
[clang-format] C# does not indent braced initializers as continuations

Summary: C# treats object initializers as braced init blocks. Braced init blocks are no longer indented as continuations.

Reviewers: krasimir

Reviewed By: krasimir

Subscribers: cfe-commits

Tags: #clang-format, #clang

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