platform/upstream/llvm.git
23 months ago[mlir][sparse] add sparse matmul codegen check tests
Aart Bik [Tue, 8 Nov 2022 22:58:45 +0000 (14:58 -0800)]
[mlir][sparse] add sparse matmul codegen check tests

This found an insertion point bug in access pattern expansion

Reviewed By: bixia

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

23 months ago[ObjC][ARC] Fix non-deterministic behavior in ProvenanceAnalysis
Akira Hatanaka [Tue, 8 Nov 2022 22:26:51 +0000 (14:26 -0800)]
[ObjC][ARC] Fix non-deterministic behavior in ProvenanceAnalysis

ProvenanceAnalysis::relatedCheck was giving different answers depending
on the order in which the pointers were passed.

Specifically, it was returning different values when A and B were both
loads and were both referring to identifiable objects, but only one was
used by a store instruction.

23 months ago[mlir][sparse] 3-dimensional sparse tensor insertion test
Aart Bik [Tue, 8 Nov 2022 21:10:54 +0000 (13:10 -0800)]
[mlir][sparse] 3-dimensional sparse tensor insertion test

Reviewed By: Peiming

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

23 months ago[clangd] Avoid escaping issues in system-include-extractor.test
Sam McCall [Tue, 8 Nov 2022 22:48:15 +0000 (23:48 +0100)]
[clangd] Avoid escaping issues in system-include-extractor.test

23 months ago[Driver] Refactor err_drv_unsupported_option_argument call sites to use llvm::opt...
Fangrui Song [Tue, 8 Nov 2022 22:39:09 +0000 (14:39 -0800)]
[Driver] Refactor err_drv_unsupported_option_argument call sites to use llvm::opt::Arg::getSpelling

For `-foo=bar`, getSpelling return `-foo=` which is exactly what we need from
the diagnostic. Drop `-` from the err_drv_unsupported_option_argument template.
This change makes `--` long option diagnostics more convenient.

Reviewed By: lenary

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

23 months ago[lld-macho] Fix bugs around EH_Frame symbols
Jez Ng [Tue, 8 Nov 2022 21:33:32 +0000 (16:33 -0500)]
[lld-macho] Fix bugs around EH_Frame symbols

While extending the map file to cover unwind info, I realized we had two
issues with our EH_Frame symbols:

1. Their size was not set
2. We would create two EH_Frame symbols per frame when we only needed
   one. This was because the Defined constructor would add the symbol
   itself to InputSection::symbols, but we were also manually appending
   the symbol to that same vector.

Note that ld64 prints "CIE" and "FDE for: <function>" instead of just
"EH_Frame", but I'm punting on that for now unless we discover that
users really depend upon it.

Reviewed By: #lld-macho, Roger

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

23 months ago[lld-macho] Emit map file entry for compact unwind info
Jez Ng [Tue, 8 Nov 2022 21:33:28 +0000 (16:33 -0500)]
[lld-macho] Emit map file entry for compact unwind info

Just like ld64 does.

Reviewed By: #lld-macho, Roger

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

23 months ago[lld-macho] Overhaul map file code
Jez Ng [Tue, 8 Nov 2022 21:33:22 +0000 (16:33 -0500)]
[lld-macho] Overhaul map file code

The previous map file code left out was modeled after LLD-ELF's
implementation. However, ld64's map file differs quite a bit from
LLD-ELF's. I've revamped our map file implementation so it is better
able to emit ld64-style map files.

Notable differences:
* ld64 doesn't demangle symbols in map files, regardless of whether
  `-demangle` is passed. So we don't have to bother with
  `getSymbolStrings()`.
* ld64 doesn't emit symbols in cstring sections; it emits just the
  literal values. Moreover, it emits these literal values regardless of
  whether they are labeled with a symbol.
* ld64 emits map file entries for things that are not strictly symbols,
  such as unwind info, GOT entries, etc. That isn't handled in this
  diff, but this redesign makes them easy to implement.

Additionally, the previous implementation sorted the symbols so as to
emit them in address order. This was slow and unnecessary -- the symbols
can already be traversed in address order by walking the list of
OutputSections. This brings significant speedups. Here's the numbers
from the chromium_framework_less_dwarf benchmark on my Mac Pro, with the
`-map` argument added to the response file:

             base            diff           difference (95% CI)
  sys_time   2.922 ± 0.059   2.950 ± 0.085  [  -0.7% ..   +2.5%]
  user_time  11.464 ± 0.191  8.290 ± 0.123  [ -28.7% ..  -26.7%]
  wall_time  11.235 ± 0.175  9.184 ± 0.169  [ -19.3% ..  -17.2%]
  samples    16              23

(It's worth noting that map files are written in parallel with the
output binary, but they often took longer to write than the binary
itself.)

Finally, I did further cleanups to the map-file.s test -- there was no
real need to have a custom-named section. There were also alt_entry
symbol declarations that had no corresponding definition. Either way,
neither custom-named sections nor alt_entry symbols trigger special code
paths in our map file implementation.

Reviewed By: #lld-macho, Roger

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

23 months ago[mlir][sparse] first general insertion implementation with pure codegen
Aart Bik [Fri, 4 Nov 2022 19:23:03 +0000 (12:23 -0700)]
[mlir][sparse] first general insertion implementation with pure codegen

This revision generalizes lowering the sparse_tensor.insert op into actual code that directly operates on the memrefs of a sparse storage scheme. The current insertion strategy does *not* rely on a cursor anymore, with introduces some testing overhead for each insertion (but still proportional to the rank, as before). Over time, we can optimize the code generation, but this version enables us to finish the effort to migrate from library to actual codegen.

Things to do:
(1) carefully deal with (un)ordered and (not)unique
(2) omit overhead when not needed
(3) optimize and specialize
(4) try to avoid the pointer "cleanup" (at HasInserts), and make sure the storage scheme is consistent at every insertion point (so that it can "escape" without concerns).

Reviewed By: Peiming

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

23 months ago[mlir][LLVMDebugTranslation] Move the check for FusedLoc scope
River Riddle [Tue, 8 Nov 2022 03:02:18 +0000 (19:02 -0800)]
[mlir][LLVMDebugTranslation] Move the check for FusedLoc scope

Shift it to where we already check for FusedLoc, which removes the
need to cast multiple times.

23 months ago[mlir][LLVMDebugTranslation] Add inlinedAt to the key when caching locations
River Riddle [Tue, 8 Nov 2022 03:01:14 +0000 (19:01 -0800)]
[mlir][LLVMDebugTranslation] Add inlinedAt to the key when caching locations

This avoids accidentally using the wrong inlined at scope when translating
locations.

23 months ago[mlir][NVGPU] Fix -Wunsequenced warning
rkayaith [Tue, 8 Nov 2022 20:42:50 +0000 (15:42 -0500)]
[mlir][NVGPU] Fix -Wunsequenced warning

llvm-project/mlir/lib/Conversion/NVGPUToNVVM/NVGPUToNVVM.cpp:441:25:
warning: multiple unsequenced modifications to 'asmArgIdx'
[-Wunsequenced]
  ss << "$" << asmArgIdx++ << ",$" << asmArgIdx++ << ";";
                        ^                      ~~

23 months ago[clang-format][NFCish] Alphabetical sort Format.(h|pp)
Björn Schäpers [Fri, 4 Nov 2022 11:38:06 +0000 (12:38 +0100)]
[clang-format][NFCish] Alphabetical sort Format.(h|pp)

I've:
- Sorted the members of FormatStyle alphabetical. The enums and structs
  are kept close to the member.
- Sorted the yaml io functions, based on the type they operate on.
- Sorted the initializers in getLLVMStyle(), except that penalities are
  kept at the end.
- Sorted the io of FormatStyle, this changes the --dump-config behavior.
- Moved the deprecated options into the only input case, this also
  changes --dump-config, it does not put the not directly used options
  in the .clang-format anymore.
- Sorted the comparisons in operator==.
- Added WhiteSpaceMacros in operator==, I've not actively looked if all
  other members are compared.
- This showed flawed tests (or in my opinion a flawed io operation, but
  that is another discussion and change).

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

23 months ago[Visualizers] Add natvis visualizers for various internal llvm classes
Trass3r [Tue, 8 Nov 2022 20:44:46 +0000 (20:44 +0000)]
[Visualizers] Add natvis visualizers for various internal llvm classes

Also improve DisplayStrings for array and string types.

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

23 months ago[mlir-opt] Add '-p' as an alias for '-pass-pipeline'
rkayaith [Thu, 3 Nov 2022 18:29:44 +0000 (14:29 -0400)]
[mlir-opt] Add '-p' as an alias for '-pass-pipeline'

The pipeline strings have been getting more verbose over time, adding an
alias for the option should help improve the ergonomics a bit.

Reviewed By: rriddle

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

23 months ago[mlir][spirv] Change translation to use spirv.module
rkayaith [Wed, 12 Oct 2022 21:32:32 +0000 (17:32 -0400)]
[mlir][spirv] Change translation to use spirv.module

Update the SPIRV `mlir-translate` translations to translate to/from
`spirv.module` instead of `builtin.module`. This simplifies the
translation since the code no longer needs to walk the module looking
for a SPIRV module, however it requires passing `-no-implicit-module` to
all the tests.

Reviewed By: antiagainst

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

23 months ago[AArch64] Allow users-facing feature names in clang target attributes
David Green [Tue, 8 Nov 2022 19:30:26 +0000 (19:30 +0000)]
[AArch64] Allow users-facing feature names in clang target attributes

D133848 added support for the GCC format of target("..") attributes. The
supported formats to match gcc are:
//  "arch=<arch>" - parsed to features as per -march=..
//  "cpu=<cpu>" - parsed to features as per -mcpu=.., with CPU set to <cpu>
//  "tune=<cpu>" - TuneCPU set to <cpu>
//  "+feature", "+nofeature" - Add (or remove) feature.

We also support the existing formats, previously accepted by clang, for
compatibility with the existing code and intrinsics code:
//  "feature", "no-feature" - Add (or remove) feature.

The clang formats would accept and use internal feature names
("fullfp16"/"neon"/"sve") as opposed to the user facing names
("fp16"/"simd"/"sve"). Usually they use the same names, but can be
different for cases like fp, fullfp16 and mte (among others).

This patch makes the clang format also except the user facing names, by
parsing the features through getArchExtFeature. There is a fallback if
the name is not recognized (like "fullfp16"), where we add the existing
string which should then be checked later for consistency. This allows
the internal names to be used as before, so long as they are recognized
as internal names. (Note that we currently don't have an implementation
of isValidFeatureName. The backend will currently give an error like
"'-sid' is not a recognized feature for this target (ignoring feature)."
This should be improved in a later patch once an implementation of
isValidFeatureName in clang is present).

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

23 months ago[clang][Headers] Do not define varargs macros for __need___va_list
Adhemerval Zanella [Wed, 10 Aug 2022 14:47:07 +0000 (11:47 -0300)]
[clang][Headers] Do not define varargs macros for __need___va_list

The glibc uses the define to avoid namespace polution on headers
that requires variadic argument, where the inclusion of stdarg.h is
required to obtain the va_list definition.

For such cases only __gnuc_va_list is required.

Reviewed By: MaskRay

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

23 months ago[AArch64]Combine BFXIL to ORR with right shift for ISD::OR instruction selection
Mingming Liu [Fri, 4 Nov 2022 21:09:13 +0000 (14:09 -0700)]
[AArch64]Combine BFXIL to ORR with right shift for ISD::OR instruction selection

- This extends the existing helper function 'isWorthFoldingIntoOrrWithLeftShift' into
  'isWorthFoldingIntoOrrWithShift', and encode right-shift imm (the
  encoding of left-shift imm is no-op).

Reviewed By: dmgreen

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

23 months ago[include-cleaner] Missing changes from 38cccb906603
Sam McCall [Tue, 8 Nov 2022 19:18:10 +0000 (20:18 +0100)]
[include-cleaner] Missing changes from 38cccb906603

23 months ago[include-cleaner] pass through recorded macro refs in walkUsed
Sam McCall [Tue, 8 Nov 2022 15:33:08 +0000 (16:33 +0100)]
[include-cleaner] pass through recorded macro refs in walkUsed

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

23 months agoRevert "[Assignment Tracking][7/*] Add assignment tracking functionality to clang"
OCHyams [Tue, 8 Nov 2022 18:41:17 +0000 (18:41 +0000)]
Revert "[Assignment Tracking][7/*] Add assignment tracking functionality to clang"

This reverts commit 28f9636edd7d4e5f3eba1e3d0d37ec53d616481f.

Bot failure: https://lab.llvm.org/buildbot/#/builders/109/builds/50251

23 months ago[SVE] Extend getMemVTFromNode to cover the sret variants of sve.ld2/3/4.
Paul Walker [Mon, 22 Aug 2022 16:19:48 +0000 (17:19 +0100)]
[SVE] Extend getMemVTFromNode to cover the sret variants of sve.ld2/3/4.

This enables the use of reg+imm addressing modes to match the
non-sret variants of these intrinsics.

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

23 months ago[X86] SkylakeClientModel - fix instregex typo. NFCI.
Simon Pilgrim [Tue, 8 Nov 2022 18:40:23 +0000 (18:40 +0000)]
[X86] SkylakeClientModel - fix instregex typo. NFCI.

The extra '?' is useless as it only makes a single letter optional and we can only match the SI64 pattern anyway (V?)CVT(T?)SS2SIrr has a different scheduler def

23 months ago[mlir][sparse] Add option enable-buffer-initialization to initialize the memory buffe...
bixia1 [Mon, 7 Nov 2022 23:49:06 +0000 (15:49 -0800)]
[mlir][sparse] Add option enable-buffer-initialization to initialize the memory buffers for sparse tensors to support debugging.

Reviewed By: aartbik

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

23 months ago[llvm-debuginfod-find] Fix test/behavior on Windows.
Daniel Thornburgh [Tue, 8 Nov 2022 17:51:52 +0000 (09:51 -0800)]
[llvm-debuginfod-find] Fix test/behavior on Windows.

23 months ago[Assignment Tracking][7/*] Add assignment tracking functionality to clang
OCHyams [Tue, 8 Nov 2022 16:58:53 +0000 (16:58 +0000)]
[Assignment Tracking][7/*] Add assignment tracking functionality to clang

The Assignment Tracking debug-info feature is outlined in this RFC:

https://discourse.llvm.org/t/
rfc-assignment-tracking-a-better-way-of-specifying-variable-locations-in-ir

This patch plumbs the AssignmentTrackingPass (AKA declare-to-assign), added in
the previous patch in this set, into the optimisation pipeline from
clang. clang/test/CodeGen/assignment-tracking/assignment-tracking.cpp is the
main test for this patch.

Note: while clang (with the help of the declare-to-assign pass) can now emit
Assignment Tracking metadata, the llvm middle and back ends don't yet
understand it.

Reviewed By: jmorse

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

23 months ago[OpenMP][NFC] Unclaim iterators in 'map' clause and motion clauses
Chi Chun Chen [Tue, 8 Nov 2022 17:43:07 +0000 (11:43 -0600)]
[OpenMP][NFC] Unclaim iterators in 'map' clause and motion clauses

23 months ago[NFC] Ignore unused vars in no-asserts builds
Jordan Rupprecht [Tue, 8 Nov 2022 17:04:04 +0000 (09:04 -0800)]
[NFC] Ignore unused vars in no-asserts builds

23 months ago[clang][Headers] Only define FLT_EVAL_METHOD for C99 and later
Adhemerval Zanella [Mon, 8 Aug 2022 20:35:12 +0000 (17:35 -0300)]
[clang][Headers] Only define FLT_EVAL_METHOD for C99 and later

It was reported by glibc conform test [1].

[1] https://sourceware.org/git/?p=glibc.git;a=blob;f=conform/data/float.h-data;h=7b98fc03447b8918da4a0cf47d41fb3e17f4f791;hb=HEAD

Reviewed By: MaskRay

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

23 months ago[Assignment Tracking][6/*] Add trackAssignments function
OCHyams [Mon, 7 Nov 2022 17:39:40 +0000 (17:39 +0000)]
[Assignment Tracking][6/*] Add trackAssignments function

The Assignment Tracking debug-info feature is outlined in this RFC:

https://discourse.llvm.org/t/
rfc-assignment-tracking-a-better-way-of-specifying-variable-locations-in-ir

Add trackAssignments which adds assignment tracking metadata to a function for
a specified set of variables. The intended callers are the inliner and the
front end - those calls will be added in separate patches.

I've added a pass called declare-to-assign (AssignmentTrackingPass) that
converts dbg.declare intrinsics to dbg.assigns using trackAssignments so that
the function can be easily tested (see
llvm/test/DebugInfo/Generic/track-assignments.ll). The pass could also be used
by front ends to easily test out enabling assignment tracking.

Reviewed By: jmorse

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

23 months agoFix call to utohexstr
Aaron Ballman [Tue, 8 Nov 2022 16:50:10 +0000 (11:50 -0500)]
Fix call to utohexstr

This was passing a width but failed to pass the preceding boolean
argument for whether to use to upper or lowercase hex digits.

Amends d19ba74dee0b9ab553bd8a6ef5b67ff349f4bf13

23 months ago[AArch64][SVE2] Add the SVE2.1 pmov instructions
David Sherwood [Mon, 7 Nov 2022 16:49:59 +0000 (16:49 +0000)]
[AArch64][SVE2] Add the SVE2.1 pmov instructions

This patch adds the assembly/disassembly for the following instructions:

pmov : Move predicate to vector
pmov : Move vector to predicate

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2022-09

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

23 months agoReapply: [NFC] Move getDebugValueLoc from static in Local.cpp to DebugInfo.h
OCHyams [Mon, 7 Nov 2022 15:12:18 +0000 (15:12 +0000)]
Reapply: [NFC] Move getDebugValueLoc from static in Local.cpp to DebugInfo.h

Reverted in b22d80dc6a6af6328d68f7b944627f9278ff6ffb.

Move getDebugValueLoc so that it can be accessed from DebugInfo.h for the
Assignment Tracking patch stack and remove redundant parameter Src.

Reviewed By: jryans

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

23 months agoRevert "[clang] Instantiate alias templates with sugar"
Alexander Kornienko [Tue, 8 Nov 2022 13:03:19 +0000 (14:03 +0100)]
Revert "[clang] Instantiate alias templates with sugar"

This reverts commit 279fe6281d2ca5b2318c7437316c28750feaac8d, which causes
non-linear compilation time growth. See https://reviews.llvm.org/D136565#3914755

23 months ago[SLP]Fix PR58863: Mask index beyond mask size for non-power-2 insertelement analysis.
Alexey Bataev [Tue, 8 Nov 2022 14:16:30 +0000 (06:16 -0800)]
[SLP]Fix PR58863: Mask index beyond mask size for non-power-2 insertelement analysis.

Need to check if the insertelement mask size is reached during cost analysis to avoid compiler crash.

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

23 months agoReapply "[SLP] Extend reordering data of tree entry to support PHInodes".
skc7 [Tue, 8 Nov 2022 08:07:12 +0000 (13:37 +0530)]
Reapply "[SLP] Extend reordering data of tree entry to support PHInodes".

Reapplies 87a2086 (which was reverted in 656f1d8).
Fix for scalable vectors in getInsertIndex merged in 46d53f4.

Reviewed By: ABataev

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

23 months ago[Includecleaner] Introduce RefType to ast walking
Kadir Cetinkaya [Mon, 29 Aug 2022 08:34:01 +0000 (10:34 +0200)]
[Includecleaner] Introduce RefType to ast walking

RefTypes are distinct categories for each reference to a symbol. They
are signals indicating strength of a reference, that'll enable different
decision making based on the finding being provided.

There are 3 kinds of ref types:
- Explicit, the reference is spelled in the code.
- Implicit, the reference is not directly visible in the code.
- Ambigious, the reference exists but can't be proven as used (e.g.
  overloads brought in by a using decl but not used by the code).

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

23 months agoReapply: Fix warning: comparison of integers of different signs
OCHyams [Mon, 7 Nov 2022 12:33:23 +0000 (12:33 +0000)]
Reapply: Fix warning: comparison of integers of different signs

Buildbot failure:
https://lab.llvm.org/buildbot/#/builders/36/builds/26925

Review & commit:
https://reviews.llvm.org/D132224
https://reviews.llvm.org/rG171f7024cc82e8702abebdedb699d37b50574be7

23 months agoRevert "[AArch64] Precommit test for D137069; NFC"
chenglin.bi [Tue, 8 Nov 2022 15:00:14 +0000 (23:00 +0800)]
Revert "[AArch64] Precommit test for D137069; NFC"

This reverts commit 281f2134a730f147428d75c09a28f0c5e1be95d9.

23 months agoReapply [Assignment Tracking][5/*] Add core infrastructure for instruction reference
OCHyams [Mon, 7 Nov 2022 11:56:36 +0000 (11:56 +0000)]
Reapply [Assignment Tracking][5/*] Add core infrastructure for instruction reference

Previously reverted in 41f5a0004e442ae71c8e754fdadb4bd1e172fb2d. Fold in
D133576 previously reverted in d29d5ffb6332569e85d5eda5130603bbd8664635.

---

The Assignment Tracking debug-info feature is outlined in this RFC:

https://discourse.llvm.org/t/
rfc-assignment-tracking-a-better-way-of-specifying-variable-locations-in-ir

Overview
It's possible to find intrinsics linked to an instruction by looking at the
MetadataAsValue uses of the attached DIAssignID. That covers instruction ->
intrinsic(s) lookup. Add a global DIAssignID -> instruction(s) map which gives
us the ability to perform intrinsic -> instruction(s) lookup. Add plumbing to
keep the map up to date through optimisations and add utility functions
including two that perform those lookups. Finally, add a unittest.

Details
In llvm/lib/IR/LLVMContextImpl.h add AssignmentIDToInstrs which maps DIAssignID
* attachments to Instruction *s. Because the DIAssignID * is the key we can't
use a TrackingMDNodeRef for it, and therefore cannot easily update the mapping
when a temporary DIAssignID is replaced.

Temporary DIAssignID's are only used in IR parsing to deal with metadata
forward references. Update llvm/lib/AsmParser/LLParser.cpp to avoid using
temporary DIAssignID's for attachments.

In llvm/lib/IR/Metadata.cpp add Instruction::updateDIAssignIDMapping which is
called to remove or add an entry (or both) to AssignmentIDToInstrs. Call this
from Instruction::setMetadata and add a call to setMetadata in Intruction's
dtor that explicitly unsets the DIAssignID so that the mappging gets updated.

In llvm/lib/IR/DebugInfo.cpp and DebugInfo.h add utility functions:

    getAssignmentInsts(const DbgAssignIntrinsic *DAI)
    getAssignmentMarkers(const Instruction *Inst)
    RAUW(DIAssignID *Old, DIAssignID *New)
    deleteAll(Function *F)
    deleteAssignmentMarkers(const Instruction *Inst)

These core utils are tested in llvm/unittests/IR/DebugInfoTest.cpp.

Reviewed By: jmorse

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

23 months ago[X86] CVTTSS2SI64rm has the same scheduler def as (V)CVTSS2SI64rm
Simon Pilgrim [Tue, 8 Nov 2022 14:35:30 +0000 (14:35 +0000)]
[X86] CVTTSS2SI64rm has the same scheduler def as (V)CVTSS2SI64rm

None of Haswell/Broadwell/Skylake/Icelake treat CVTTSS2SI64rm differently from CVTSS2SI64rm (or the AVX variants)

Confirmed with Agner, uops.info and Intel AoM

23 months agoFix dupe word typos
Rageking8 [Tue, 8 Nov 2022 14:28:25 +0000 (15:28 +0100)]
Fix dupe word typos

This revision fixes typos where there are 2 consecutive words which are duplicated.
There should be no code changes in this revision (only changes to comments and docs).
Do let me know if there are any undesirable changes in this revision. Thanks.

23 months ago[include-cleaner] Record main-file macro occurences and includes
Sam McCall [Wed, 26 Oct 2022 00:21:06 +0000 (02:21 +0200)]
[include-cleaner] Record main-file macro occurences and includes

The occurrences are roots for finding used headers, like walkAST.
Includes are the targets we're matching used headers against.

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

23 months agoReland "[llvm][NFC] Use c++17 style variable type traits"
Nathan James [Tue, 8 Nov 2022 14:15:04 +0000 (14:15 +0000)]
Reland "[llvm][NFC] Use c++17 style variable type traits"

This reverts commit 632a389f96355cbe7ed8fa7b8d2ed6267c92457c.

This relands commit
1834a310d060d55748ca38d4ae0482864c2047d8.

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

23 months ago[AArch64] Precommit test for D137069; NFC
chenglin.bi [Tue, 8 Nov 2022 14:13:42 +0000 (22:13 +0800)]
[AArch64] Precommit test for D137069; NFC

23 months ago[VectorCombine] add test with addrspacecast; NFC
Sanjay Patel [Mon, 7 Nov 2022 17:39:32 +0000 (12:39 -0500)]
[VectorCombine] add test with addrspacecast; NFC

D137341

23 months ago[OpenMP][mingw] Fix build for aarch64 target
Alvin Wong [Fri, 4 Nov 2022 22:22:50 +0000 (00:22 +0200)]
[OpenMP][mingw] Fix build for aarch64 target

This patch changes AArch64 + `__GNUC__` to use `__sync` builtins to
implement internal atomic macros just like for Unix, because mingw-w64
is missing some of the intrinsics which the MSVC codepath is using.

Then some remaining intel-only functions are removed from dllexport to
fix linking.

This should fix https://github.com/llvm/llvm-project/issues/56349.

Reviewed By: natgla

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

23 months ago[NFC][intelpt] Improve IntelPT trace bundle documentation
Jakob Johnson [Sun, 6 Nov 2022 22:32:18 +0000 (14:32 -0800)]
[NFC][intelpt] Improve IntelPT trace bundle documentation

Mention that the LLVM/clang triple must be provided if the trace will be
consumed via `SBTraceCursor`

Test Plan:

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

23 months agoRevert "[llvm][NFC] Use c++17 style variable type traits"
Nathan James [Tue, 8 Nov 2022 13:11:10 +0000 (13:11 +0000)]
Revert "[llvm][NFC] Use c++17 style variable type traits"

This reverts commit 1834a310d060d55748ca38d4ae0482864c2047d8.

23 months ago[SLP][NFC] Restructure getInsertIndex
skc7 [Mon, 7 Nov 2022 15:58:03 +0000 (21:28 +0530)]
[SLP][NFC] Restructure getInsertIndex

Reviewed By: ABataev

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

23 months ago[AArch64]SME2 Single and Multi vector Shift and Multiply instructions
Caroline Concatto [Tue, 8 Nov 2022 12:02:04 +0000 (12:02 +0000)]
[AArch64]SME2 Single and Multi vector  Shift and Multiply instructions

This patch adds the assembly/disassembly for the following instructions:

  SQRSHR (four registers): Multi-vector signed saturating rounding shift right narrow by immediate.
         (two registers): Multi-vector signed saturating rounding shift right narrow by immediate.
  SQRSHRN: Multi-vector signed saturating rounding shift right narrow by immediate and interleave.
  SQRSHRU (four registers): Multi-vector signed saturating rounding shift right unsigned narrow by immediate.
          (two registers): Multi-vector signed saturating rounding shift right unsigned narrow by immediate.
  SQRSHRUN: Multi-vector signed saturating rounding shift right unsigned narrow by immediate and interleave.
  UQRSHR (four registers): Multi-vector unsigned saturating rounding shift right narrow by immediate
         (two registers): Multi-vector unsigned saturating rounding shift right narrow by immediate.
  UQRSHRN: Multi-vector unsigned saturating rounding shift right narrow by immediate and interleave.

The reference can be found here:

https://developer.arm.com/documentation/ddi0602/2022-09

Reviewed By: paulwalker-arm

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

23 months agoFix build file for PDLL tests.
Johannes Reifferscheid [Tue, 8 Nov 2022 12:24:08 +0000 (13:24 +0100)]
Fix build file for PDLL tests.

23 months ago[llvm][NFC] Use c++17 style variable type traits
Nathan James [Tue, 8 Nov 2022 12:22:50 +0000 (12:22 +0000)]
[llvm][NFC] Use c++17 style variable type traits

This was done as a test for D137302 and it makes sense to push these changes

Reviewed By: dblaikie

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

23 months agoFix duplicate word typos; NFC
Rageking8 [Tue, 8 Nov 2022 12:21:23 +0000 (07:21 -0500)]
Fix duplicate word typos; NFC

This revision fixes typos where there are 2 consecutive words which are
duplicated. There should be no code changes in this revision (only
changes to comments and docs). Do let me know if there are any
undesirable changes in this revision. Thanks.

23 months ago[Test] Add tests with range checks with known constant ranges
Dmitry Makogon [Tue, 8 Nov 2022 10:56:19 +0000 (17:56 +0700)]
[Test] Add tests with range checks with known constant ranges

LoopPredication might be able to turn such checks (which are
not necessarily are done on IV) into loop invariant checks.

23 months ago[AMDGPU] Declutter applyPreexistingWaitcnt()
Stephen Thomas [Tue, 8 Nov 2022 11:39:41 +0000 (11:39 +0000)]
[AMDGPU] Declutter applyPreexistingWaitcnt()

Declutter applyPreexistingWaitcnt() a little by abstracting the code
that updates the operands to S_WAITCNT and S_WAITCNT_VSCNT instructions
into discrete functions.

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

23 months ago[clang][Sema][NFC] Remove two nonsensical dyn_cast_or_null
Timm Bäder [Mon, 7 Nov 2022 08:46:08 +0000 (09:46 +0100)]
[clang][Sema][NFC] Remove two nonsensical dyn_cast_or_null

The values used here are never null.

23 months agoAMDGPU/GlobalISel: Fix combine crash because LI is not set in prelegalizer
Petar Avramovic [Tue, 8 Nov 2022 09:32:04 +0000 (10:32 +0100)]
AMDGPU/GlobalISel: Fix combine crash because LI is not set in prelegalizer

Caused by legacy min/max combines (select + cmp) asking for legalizer info
in prelegalizer (D135047 added combine to all_combines).
Combine still does not work for AMDGPU since destination opcode is custom,
not legal. Similar combine works on DAG since it asks for legal or custom.

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

23 months ago[LoongArch] Add support for the BranchRelaxation pass
Xiaodong Liu [Wed, 2 Nov 2022 07:47:26 +0000 (15:47 +0800)]
[LoongArch] Add support for the BranchRelaxation pass

When the branch target is out of the range represented by the current
branch instruction's immediate, branch relaxation is required. There
are three types of immediate for branch instructions on LoongArch,
including simm16, simm21 and simm26. And the real branch target
address is PC + sext(simmXX << 2). In addition, the indirect branch
way is implemented to support larger branch target.

BranchRelaxation pass calls `RenumberBlocks` to renumber all of the
machine basic blocks in the function. So the machine basic blocks
number changed in some test cases.

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

23 months ago[include-cleaner] Add the missing parts of Symbol and Header clases.
Sam McCall [Tue, 25 Oct 2022 19:04:59 +0000 (21:04 +0200)]
[include-cleaner] Add the missing parts of Symbol and Header clases.

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

23 months agoUse opt -passes=<name> instead of opt -name
Bjorn Pettersson [Mon, 7 Nov 2022 09:46:57 +0000 (10:46 +0100)]
Use opt -passes=<name> instead of opt -name

Updated the RUN line in several test cases to use the new PM syntax
  opt -passes=<pipeline>
instead of the deprecated syntax
  opt -pass1 -pass2

23 months ago[clang][test] Use opt -passes=<name> instead of opt -name
Bjorn Pettersson [Sun, 6 Nov 2022 17:38:32 +0000 (18:38 +0100)]
[clang][test] Use opt -passes=<name> instead of opt -name

Updated the RUN line in several test cases to use the new PM syntax
  opt -passes=<pipeline>
instead of the deprecated syntax
  opt -pass1 -pass2

This was not a complete cleanup in clang/test. But just a swipe using
some simple search-and-replace. Mainly for RUN lines involving
-mem2reg, -instnamer and -early-cse.

23 months agoAdd missing PDLL libs.
Johannes Reifferscheid [Tue, 8 Nov 2022 11:14:32 +0000 (12:14 +0100)]
Add missing PDLL libs.

23 months agoAdd const information about AST nodes used to construct CFG elements.
Dani Ferreira Franco Moura [Tue, 8 Nov 2022 09:14:02 +0000 (10:14 +0100)]
Add const information about AST nodes used to construct CFG elements.

Most constructors and destructors in CFG.h already specify const arguments, but some are missing this.

Reviewed By: gribozavr2, krasimir

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

23 months agoAdd missing build deps.
Johannes Reifferscheid [Tue, 8 Nov 2022 10:45:12 +0000 (11:45 +0100)]
Add missing build deps.

23 months ago[AArch64][SVE2] Add the SVE2.1 dupq and extq instructions
David Sherwood [Mon, 7 Nov 2022 17:22:54 +0000 (17:22 +0000)]
[AArch64][SVE2] Add the SVE2.1 dupq and extq instructions

This patch adds the assembly/disassembly for the following instructions:

dupq : Broadcast indexed element within each quadword vector segment (unpredicated)
extq : Extract vector segment from each pair of quadword vector segments

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2022-09

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

23 months agoSuppress warning for unused variable if assertions are disabled.
Johannes Reifferscheid [Tue, 8 Nov 2022 10:12:09 +0000 (11:12 +0100)]
Suppress warning for unused variable if assertions are disabled.

Reviewed By: bkramer

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

23 months ago[mlir:PDLL] Allow complex constraints on Rewrite arguments/results
River Riddle [Thu, 15 Sep 2022 23:18:32 +0000 (16:18 -0700)]
[mlir:PDLL] Allow complex constraints on Rewrite arguments/results

The documentation already has examples of this, and it allows for
using nicer C++ types when defining native Rewrites.

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

23 months ago[mlir:PDLL] Don't require users to provide operands/results when all are variadic
River Riddle [Mon, 12 Sep 2022 18:43:44 +0000 (11:43 -0700)]
[mlir:PDLL] Don't require users to provide operands/results when all are variadic

When all operands or results are variadic, zero values is a perfectly valid behavior
to expect, and we shouldn't force the user to provide values in this case. For example,
when creating a call or a return operation we often don't want/need to provide return
values.

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

23 months ago[mlir:PDLL] Add support for building a range from a tuple within a rewrite
River Riddle [Sat, 10 Sep 2022 01:43:27 +0000 (18:43 -0700)]
[mlir:PDLL] Add support for building a range from a tuple within a rewrite

This allows for constructing type and value ranges from various sub elements,
which makes it easier to construct operations that take a range as an operand
or result type. Range construction is currently limited to within rewrites, to match
the current constraint on the PDL side.

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

23 months ago[mlir:PDL] Add support for creating ranges in rewrites
River Riddle [Fri, 9 Sep 2022 23:31:24 +0000 (16:31 -0700)]
[mlir:PDL] Add support for creating ranges in rewrites

This commit adds support for building a concatenated range from
a given set of elements, either single element or other ranges, within a
rewrite. We could conceptually extend this to support constraining
input ranges, but the logic there is quite a bit more complex so it is
left for later work when a need arises.

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

23 months ago[mlir:PDL] Add support for DialectConversion with pattern configurations
River Riddle [Thu, 8 Sep 2022 23:59:39 +0000 (16:59 -0700)]
[mlir:PDL] Add support for DialectConversion with pattern configurations

Up until now PDL(L) has not supported dialect conversion because we had no
way of remapping values or integrating with type conversions. This commit
rectifies that by adding a new "pattern configuration" concept to PDL. This
essentially allows for attaching external configurations to patterns, which
can hook into pattern events (for now just the scope of a rewrite, but we
could also pass configs to native rewrites as well). This allows for injecting
the type converter into the conversion pattern rewriter.

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

23 months ago[Test] Fix driverkit-path.c with lib64 dir
Thomas Preud'homme [Sat, 5 Nov 2022 10:07:21 +0000 (10:07 +0000)]
[Test] Fix driverkit-path.c with lib64 dir

Reviewed By: yln

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

23 months ago[AArch64]SME2 MOV Instructions
Caroline Concatto [Wed, 2 Nov 2022 09:36:50 +0000 (09:36 +0000)]
[AArch64]SME2 MOV Instructions

This patch adds the assembly/disassembly for the following instructions:

MOVA (array to vector, four registers): Move four ZA single-vector groups to four vector registers.
     (array to vector, two registers): Move two ZA single-vector groups to two vector registers.
     (tile to vector, four registers): Move four ZA tile slices to four vector registers.
     (tile to vector, single): Move ZA tile slice to vector register.
     (tile to vector, two registers): Move two ZA tile slices to two vector registers.
     (vector to array, four registers): Move four vector registers to four ZA single-vector groups.
     (vector to array, two registers): Move two vector registers to two ZA single-vector groups.
     (vector to tile, four registers): Move four vector registers to four ZA tile slices.
     (vector to tile, single): Move vector register to ZA tile slice.
     (vector to tile, two registers): Move two vector registers to two ZA tile slices.

The reference can be found here:

https://developer.arm.com/documentation/ddi0602/2022-09

It add more sizes for Matrix Operand:
MatrixOp8 and MatrixOp16
two implicit operands uimm0s2range and uimm0s4range.
and  uimm1s2range that are immediates

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

23 months ago[AArch64][SVE2] Add the SVE2.1 FP quadword reduction instructions
David Sherwood [Thu, 3 Nov 2022 11:51:29 +0000 (11:51 +0000)]
[AArch64][SVE2] Add the SVE2.1 FP quadword reduction instructions

This patch adds the assembly/disassembly for the following instructions:

faddqv   : Floating-point add recursive reduction of quadword vector segments
fmaxqv   : Floating-point maximum reduction of quadword vector segments
fmaxnmqv : Floating-point maximum number recursive reduction of quadword vector segments
fminqv   : Floating-point minimum recursive reduction of quadword vector segments
fminnmqv : Floating-point minimum number recursive reduction of quadword vector segments

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2022-09

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

23 months ago[clang][pdb] Don't include -fmessage-length in PDB buildinfo
Tobias Hieta [Tue, 8 Nov 2022 08:23:10 +0000 (09:23 +0100)]
[clang][pdb] Don't include -fmessage-length in PDB buildinfo

As discussed in https://reviews.llvm.org/D136474 -fmessage-length
creates problems with reproduciability in the PDB files.

This patch just drops that argument when writing the PDB file.

Reviewed By: hans

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

23 months ago[mlir][vector] Add vector.scalable.insert/extract ops
Javier Setoain [Wed, 15 Jun 2022 13:27:25 +0000 (14:27 +0100)]
[mlir][vector] Add vector.scalable.insert/extract ops

These new operations match the semantics of
llvm.experimental.vector.insert and llvm.experimental.vector.extract.

`vector.scalable.insert` and `vector.scalable.extract` allow,
respectively, insert vectors into scalable vectors, and extract vectors
from scalable vectors.

The discussion about the inclusion of these operations is here:
https://discourse.llvm.org/t/rfc-interfacing-between-fixed-length-and-scalable-vectors-for-vls-vector-code-on-scalable-vector-architectures

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

23 months ago[mlir][llvm] Test LLVM IR constant import separately.
Tobias Gysi [Tue, 8 Nov 2022 08:23:48 +0000 (10:23 +0200)]
[mlir][llvm] Test LLVM IR constant import separately.

The revision moves tests related to LLVM IR constant import
into a separate constant.ll file and adds tests for integer,
null and undef immediates.

Depends on D136679

Reviewed By: ftynse

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

23 months ago[Statepoint] Use default attributes for some GC intrinsics
Nikita Popov [Fri, 28 Oct 2022 09:21:30 +0000 (11:21 +0200)]
[Statepoint] Use default attributes for some GC intrinsics

This adds the default intrinsic attributes (nosync, nofree, nocallback,
willreturn) to the gc.result, gc.relocate, gc.pointer.base and
gc.pointer.offset intrinsics. As far as I understand, all of these
are supposed to be pure. Some quotes from LangRef:

> A gc.result is modeled as a ‘readnone’ pure function. It has no
> side effects since it is just a projection of the return value of
> the previous call represented by the gc.statepoint.

> A gc.relocate is modeled as a readnone pure function. It has no
> side effects since it is just a way to extract information about
> work done during the actual call modeled by the gc.statepoint.

Having willreturn in particular will be important to avoid
optimization regressions in the future.

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

23 months ago[X86] Use default attributes for even more intrinsics
Nikita Popov [Mon, 7 Nov 2022 15:08:15 +0000 (16:08 +0100)]
[X86] Use default attributes for even more intrinsics

Another followup to D136939: This switches readonly X86 intrinsics
to use default attributes (nosync, nofree, nocallback and willreturn).

With this, all readnone/readonly intrinsics should be covered,
only memory writing intrinsics are left.

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

23 months ago[mlir][llvm] Update insertion point handling in LLVM import.
Tobias Gysi [Tue, 8 Nov 2022 07:46:39 +0000 (09:46 +0200)]
[mlir][llvm] Update insertion point handling in LLVM import.

Insert constants and globals in order by maintaining the position
of the constant and global inserted last. Update the tests
to reflect the updated insertion order. Also make sure functions
are always inserted at the end of the module instead of at
the second last position and delete a spurious function in
the intrinsic.ll that seems to exist to avoid the first
function under test ends up at the end of the module.

Reviewed By: ftynse

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

23 months ago[AMDGPU][GlobalISel] Support mad/fma_mix selection
Pierre van Houtryve [Wed, 28 Sep 2022 07:47:35 +0000 (07:47 +0000)]
[AMDGPU][GlobalISel] Support mad/fma_mix selection

Adds support for selecting the following instructions using GlobalISel:
- v_mad_mix/v_fma_mix
- v_mad_mixhi/v_fma_mixhi
- v_mad_mixlo/v_fma_mixlo

To select those instructions properly, some additional changes were
needed which impacted other tests as well.

Reviewed By: arsenm

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

23 months ago[NFC] [C++20] [Modules] Rename ASTWriter::isWritingStdCXXNamedModules
Chuanqi Xu [Tue, 8 Nov 2022 07:53:08 +0000 (15:53 +0800)]
[NFC] [C++20] [Modules] Rename ASTWriter::isWritingStdCXXNamedModules

According to the discussion in
https://discourse.llvm.org/t/rfc-unifying-the-terminology-about-modules-in-clang/66054,
this patch rename ASTWriter::isWritingNamedModules to ASTWriter::isWrittingStdCXXNamedModules
to make the name more clear.

23 months ago[AMDGPU] Add & use `hasNamedOperand`, NFC
Pierre van Houtryve [Mon, 7 Nov 2022 11:54:18 +0000 (11:54 +0000)]
[AMDGPU] Add & use `hasNamedOperand`, NFC

In a lot of places, we were just calling `getNamedOperandIdx` to check if the result was != or == to -1.
This is fine in itself, but it's verbose and doesn't make the intention clear, IMHO. I added a `hasNamedOperand` and replaced all cases I could find with regexes and manually.

Reviewed By: arsenm, foad

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

23 months ago[SIFoldOperands] Small code cleanups, NFC.
Pierre van Houtryve [Mon, 7 Nov 2022 11:32:44 +0000 (11:32 +0000)]
[SIFoldOperands] Small code cleanups, NFC.

I've been trying to understand the backend better and decided to read the code of this pass.
While doing so, I noticed parts that could be refactored to be a tiny bit clearer.
I tried to keep the changes minimal, a non-exhaustive list of changes is:
- Stylistic changes to better fit LLVM's coding style
- Removing dead/useless functions (e.g. FoldCandidate had getters, but it's a public struct!)
 - Saving regs/opcodes in variables if they're going to be used multiple times in the same condition

Reviewed By: arsenm, foad

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

23 months ago[Driver] Add -fsample-profile-use-profi
haoyuintel [Tue, 8 Nov 2022 06:51:14 +0000 (14:51 +0800)]
[Driver] Add -fsample-profile-use-profi

This patch enable `-sample-profile-use-profi` in Clang frontend as user-facing
feature. By using this patch, we can use the cflag of `-fsample-profile-use-profi`
instead of `-mllvm -sample-profile-use-profi`.

Reviewed By: hans, MaskRay

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

23 months ago[SIFoldOperands] Move `isFoldableCopy` into a separate helper, NFC.
Pierre van Houtryve [Mon, 7 Nov 2022 11:33:43 +0000 (11:33 +0000)]
[SIFoldOperands] Move `isFoldableCopy` into a separate helper, NFC.

There was quite a bit of logic there that was just in the middle of core loop. I think it makes it easier to follow when it's split off in a separate helper like the others.

Reviewed By: arsenm

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

23 months ago[X86] Add In64BitMode predicates for LOCK_INC64m, LOCK_DEC64m
Haohai Wen [Tue, 8 Nov 2022 06:04:10 +0000 (14:04 +0800)]
[X86] Add In64BitMode predicates for LOCK_INC64m, LOCK_DEC64m

These two instructions are only encodable in 64bit mode.

Reviewed By: pengfei

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

23 months ago[SimpleLoopUnswitch] Skip trivial selects in guards conditions unswitch candidates
Dmitry Makogon [Wed, 2 Nov 2022 12:44:22 +0000 (19:44 +0700)]
[SimpleLoopUnswitch] Skip trivial selects in guards conditions unswitch candidates

We do this for conditional branches, but not for guards for some reason.

Fixes pr58666.

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

23 months ago[Docs] Add my Office Hours
Paulo Matos [Tue, 8 Nov 2022 05:59:48 +0000 (21:59 -0800)]
[Docs] Add my Office Hours

23 months agoInstCombine: Fold fdiv nnan x, 0 -> copysign(inf, x)
Matt Arsenault [Mon, 17 Oct 2022 05:49:30 +0000 (22:49 -0700)]
InstCombine: Fold fdiv nnan x, 0 -> copysign(inf, x)

https://alive2.llvm.org/ce/z/gLBFKB

23 months ago[PowerPC][NFC] remove the rop-protect attribute in LIT cases.
Chen Zheng [Tue, 8 Nov 2022 05:43:06 +0000 (05:43 +0000)]
[PowerPC][NFC] remove the rop-protect attribute in LIT cases.

This flag will cause LLC warning:

"'-rop-protection' is not a recognized feature for this target
(ignoring feature)"

Remove this unused feature first. We may also need to check why
llc emits this warning as we declare '-rop-protection' not
'+rop-protection'.

23 months agollvm-reduce: Try to turn calls into something else
Matt Arsenault [Sat, 22 Oct 2022 17:05:54 +0000 (10:05 -0700)]
llvm-reduce: Try to turn calls into something else

Try to turn calls that look like operators into known
intrinsics. Also try to turn calls that look like a load or
a store into a load or store.

23 months ago[SLP][NFC] Restructure areTwoInsertFromSameBuildVector
skc7 [Mon, 7 Nov 2022 16:36:12 +0000 (22:06 +0530)]
[SLP][NFC] Restructure areTwoInsertFromSameBuildVector

Reviewed By: ABataev

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

23 months ago[mlir][arith] Convert fastmath to LLVM dialect for some arith ops.
Slava Zakharin [Tue, 8 Nov 2022 03:38:36 +0000 (19:38 -0800)]
[mlir][arith] Convert fastmath to LLVM dialect for some arith ops.

This is a follow-up on D126305 and D136225.
We can now preserve fastmath for arith::MaxFOp,MinFOp,RemFOp during
ArithToLLVM conversion.

Reviewed By: rriddle

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

23 months ago[lldb] Fix issue with re.Pattern availability
Dave Lee [Mon, 7 Nov 2022 21:20:48 +0000 (13:20 -0800)]
[lldb] Fix issue with re.Pattern availability

`re.Pattern` is introduced in Python 3.7. To support Python 3.6, fallback to typechecking against `SRE_Pattern`.

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

23 months agoMIPS/compiler_rt: use synci to flush icache on r6
YunQiang Su [Tue, 8 Nov 2022 01:43:41 +0000 (17:43 -0800)]
MIPS/compiler_rt: use synci to flush icache on r6

syscall makes it failed to build on mips64 for mipsel:
```
compiler-rt/lib/builtins/clear_cache.c:97:3: error:
call to undeclared function 'syscall'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  syscall(__NR_cacheflush, start, (end_int - start_int), BCACHE);
```

In this patch, we use `rdhwr` to get synci_step.
If synci_step is zero, it means that the hardware will maintain the coherence. We need to do nothing.
Then for r6+, `synci` is required to keep icache global.
So we can use `synci` to flush icache.
The ISA documents ask a `sync` and a `jr.hb` after `synci`.

For pre-r6, we can use cacheflush libc function, which is same on Linux and FreeBSD.

Reviewed By: MaskRay

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

23 months ago[CMake] Fix -Wstrict-prototypes
Sam James [Tue, 8 Nov 2022 01:36:43 +0000 (01:36 +0000)]
[CMake] Fix -Wstrict-prototypes

Fixes warnings (or errors, if someone injects -Werror in their build system,
which happens in fact with some folks vendoring LLVM too) with Clang 16:
```
+/var/tmp/portage.notmp/portage/sys-devel/llvm-15.0.4/work/llvm_build-abi_x86_64.amd64/CMakeFiles/CMakeTmp/src.c:3:9: warning: a function declaration without a prototype
is deprecated in all versions of C [-Wstrict-prototypes]
-/var/tmp/portage.notmp/portage/sys-devel/llvm-14.0.4/work/llvm_build-abi_x86_64.amd64/CMakeFiles/CMakeTmp/src.c:3:9: error: a function declaration without a prototype is
deprecated in all versions of C [-Werror,-Wstrict-prototypes]
 int main() {return 0;}
         ^
          void
```

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

23 months ago[flang] Add atomic_xor to list of intrinsics
Katherine Rasmussen [Tue, 1 Nov 2022 21:14:08 +0000 (14:14 -0700)]
[flang] Add atomic_xor to list of intrinsics

Add the atomic subroutine, atomic_xor, to the list of
intrinsic subroutines, add its last dummy argument to a check
for a coindexed-object, and update test.

Reviewed By: PeteSteinfeld

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