Commit Graph

3208 Commits

Author SHA1 Message Date
Bruno De Fraine
656bf13004
[AST] Don't merge memory locations in AliasSetTracker (#65731)
This changes the AliasSetTracker to track memory locations instead of
pointers in its alias sets. The motivation for this is outlined in an RFC
posted on LLVM discourse:
https://discourse.llvm.org/t/rfc-dont-merge-memory-locations-in-aliassettracker/73336

In the data structures of the AST implementation, I made the choice to
replace the linked list of `PointerRec` entries (that had to go anyway)
with a simple flat vector of `MemoryLocation` objects, but for the
`AliasSet` objects referenced from a lookup table, I retained the
mechanism of a linked list, reference counting, forwarding, etc. The
data structures could be revised in a follow-up change.
2024-01-17 15:59:13 +01:00
Karthika Devi C
61968286f9
[polly][ScheduleOptimizer] Reland Fix long compile time(hang) reported in polly (#77280)
There is no upper cap set on current Schedule Optimizer to compute
schedule. In some cases a very long compile time taken to compute the
schedule resulting in hang kind of behavior. This patch introduces a
flag 'polly-schedule-computeout' to pass the capwhich is initialized to
300000. This patch handles the compute out cases by bailing out and
exiting gracefully.

Fixed the test that failed in previous commit.

Fixes #69090
2024-01-08 09:48:02 -08:00
Eli Friedman
2cc111e422 Revert "[polly][ScheduleOptimizer] Fix long compile time(hang) reported in polly (#75141)"
This reverts commit d6c4d4c9b9.

Broke buildldbots with asserts disabled; -debug-only is only available in
asserts builds.
2024-01-02 19:00:58 -08:00
Karthika Devi C
d6c4d4c9b9
[polly][ScheduleOptimizer] Fix long compile time(hang) reported in polly (#75141)
There is no upper cap set on current Schedule Optimizer to compute
schedule. In some cases a very long compile time taken to compute the
schedule resulting in hang kind of behavior. This patch introduces a
flag 'polly-schedule-computeout' to pass the capwhich is initialized to
300000. This patch handles the compute out cases by bailing out and
exiting gracefully.

Fixes #69090
2024-01-02 10:53:29 -08:00
vient
b951239932 [polly] [CMake] Link polly-isl-test with LLVMSupport (#65424)
Otherwise link may fail if user provided additional library to link with via CMAKE_EXE_LINKER_FLAGS. Concrete example is using custom allocator, LLVMSupport provides needed -lpthread in that case.

Closes: https://github.com/llvm/llvm-project/pull/65424
2023-12-25 10:31:09 +00:00
Karthika Devi C
7ddd3d7764
[polly][NFC] Refactor reduction detection code for modularity (#72343)
This patch pulls out the memory checks from the base reduction detection
algorithm. This is the first one in the reduction patch series, to
reduce the difference in future patches.
2023-12-07 14:04:52 -08:00
Kazu Hirata
e1e34cc2a1
[Support] Remove llvm/Support/Host.h (#74261)
The header file has been deprecated since:

  commit f09cf34d00
  Author: Archibald Elliott <archibald.elliott@arm.com>
  Date:   Tue Dec 20 10:24:02 2022 +0000
2023-12-04 12:54:26 -08:00
Fangrui Song
a3ef858968 [mlir,polly] Replace uses of IRBuilder::getInt8PtrTy with getPtrTy. NFC 2023-11-27 20:58:25 -08:00
Paulo Matos
7b9d73c2f9
[NFC] Remove Type::getInt8PtrTy (#71029)
Replace this with PointerType::getUnqual().
Followup to the opaque pointer transition. Fixes an in-code TODO item.
2023-11-07 17:26:26 +01:00
Kazu Hirata
f9306f6de3
[ADT] Rename llvm::erase_value to llvm::erase (NFC) (#70156)
C++20 comes with std::erase to erase a value from std::vector.  This
patch renames llvm::erase_value to llvm::erase for consistency with
C++20.

We could make llvm::erase more similar to std::erase by having it
return the number of elements removed, but I'm not doing that for now
because nobody seems to care about that in our code base.

Since there are only 50 occurrences of erase_value in our code base,
this patch replaces all of them with llvm::erase and deprecates
llvm::erase_value.
2023-10-24 23:03:13 -07:00
Owen Pan
bf05be5b87 [polly] Reformat due to d68826dfbd 2023-10-24 03:24:05 -07:00
Kazu Hirata
7552b4d9ee [polly] Use llvm::erase_value (NFC) 2023-10-20 23:45:18 -07:00
Konrad Kleine
5bd1b93cb2 Move CallInst::CreateFree to IRBuilderBase
Similarly to D158861 I'm moving the `CreateFree` method from `CallInst` to `IRBuilderBase`.

Differential Revision: https://reviews.llvm.org/D159418
2023-09-19 12:04:17 +02:00
Konrad Kleine
45bb45f2ae [llvm] Move CallInst::CreateMalloc to IRBuilderBase::CreateMalloc
This removes `CreateMalloc` from `CallInst` and adds it to the `IRBuilderBase`
class.

We no longer needed the `Instruction *InsertBefore` and
`BasicBlock *InsertAtEnd` arguments of the `createMalloc` helper
function because we're using `IRBuilder` now. That's why I we also don't
need 4 `CreateMalloc` functions, but only two.

Differential Revision: https://reviews.llvm.org/D158861
2023-09-19 09:05:48 +02:00
Carlo Bramini
17f747b304 [polly] Dynamic libraries are not supported on Cygwin
Cygwin shares the same limitations as traditional Windows executables
for dynamic library loading, so disable building the dynamic library on
Cygwin targets.

Differential Revision: https://reviews.llvm.org/D155796
2023-09-05 14:38:35 -07:00
Fangrui Song
678e3ee123 [lldb] Fix duplicate word typos; NFC
Those fixes were taken from https://reviews.llvm.org/D137338
2023-09-01 21:32:24 -07:00
Nikita Popov
34f73967ae [polly] Remove use of getWithSamePointeeType() (NFC) 2023-07-18 11:52:27 +02:00
Johannes Doerfert
b288e66862 [Polly][FIX] Adjust enum after D153305 2023-07-03 12:49:28 -07:00
Elliot Goodrich
b0abd4893f [llvm] Add missing StringExtras.h includes
In preparation for removing the `#include "llvm/ADT/StringExtras.h"`
from the header to source file of `llvm/Support/Error.h`, first add in
all the missing includes that were previously included transitively
through this header.
2023-06-25 15:42:22 +01:00
Tobias Hieta
f98ee40f4b
[NFC][Py Reformat] Reformat python files in the rest of the dirs
This is an ongoing series of commits that are reformatting our
Python code. This catches the last of the python files to
reformat. Since they where so few I bunched them together.

Reformatting is done with `black`.

If you end up having problems merging this commit because you
have made changes to a python file, the best way to handle that
is to run git checkout --ours <yourfile> and then reformat it
with black.

If you run into any problems, post to discourse about it and
we will try to help.

RFC Thread below:

https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style

Reviewed By: jhenderson, #libc, Mordante, sivachandra

Differential Revision: https://reviews.llvm.org/D150784
2023-05-25 11:17:05 +02:00
Joshua Cao
0c316f0067 [BBUtils][NFC] Delete SplitBlockAndInsertIfThen with DT.
The method is marked for deprecation. Delete the method and move all of
its consumers to use the DomTreeUpdater version.

Reviewed By: foad

Differential Revision: https://reviews.llvm.org/D149428
2023-05-23 21:02:37 -07:00
Nikita Popov
18680a36aa [Polly] Remove some bitcasts (NFC)
No longer relevant with opaque pointers.
2023-03-17 15:59:19 +01:00
Kazu Hirata
4e585e51c1 Use *{Map,Set}::contains (NFC) 2023-03-15 22:55:35 -07:00
Kazu Hirata
0aee67ad4e [polly] Use DenseMap::contains (NFC) 2023-03-14 23:09:18 -07:00
Arthur Eubanks
d623b2f95f [PassManagerBuilder] Remove PassManagerBuilder
PassManagerBuilder is dead, long live PassBuilder!

bugpoint's -O# are now useless (and probably have been for a while given the number of passes we've removed from PassManagerBuilder). Perhaps they'll be revived if bugpoint ever works with the new PM.

Reviewed By: nikic, MaskRay

Differential Revision: https://reviews.llvm.org/D145835
2023-03-13 09:30:30 -07:00
Arthur Eubanks
7c3c981442 [Passes] Remove some legacy passes
DFAJumpThreading
JumpThreading
LibCallsShrink
LoopVectorize
SLPVectorizer
DeadStoreElimination
AggressiveDCE
CorrelatedValuePropagation
IndVarSimplify

These are part of the optimization pipeline, of which the legacy version is deprecated and being removed.
2023-03-10 17:17:00 -08:00
Michael Kruse
a71a772e9a [Polly] Fix plugin build.
The target_link_libraries call was accidentially removed in
D142580 (Remove Polly-ACC).
2023-03-09 10:56:21 -06:00
Jie Fu
8a5e9c4b35 [polly] Remove unused variable 'VectorLoops' in IslNodeBuilder.cpp (NFC)
/home/jiefu/llvm-project/polly/lib/CodeGen/IslNodeBuilder.cpp:80:11: error: unused variable 'VectorLoops' [-Werror,-Wunused-variable]
STATISTIC(VectorLoops, "Number of generated vector for-loops");
          ^
1 error generated.
2023-03-09 13:04:46 +08:00
Michael Kruse
19afbfe331 [Polly] Remove Polly-ACC.
Polly-ACC is unmaintained and since it has never been ported to the NPM pipeline, since D136621 it is not even accessible anymore without manually specifying the passes on the `opt` command line.

Since there is no plan to put it to a maintainable state, remove it from Polly.

Reviewed By: grosser

Differential Revision: https://reviews.llvm.org/D142580
2023-03-08 17:33:04 -06:00
Michael Kruse
42cd38c01e [Polly] Remove -polly-vectorizer=polly.
Polly's internal vectorizer is not well maintained and is known to not work in some cases such as region ScopStmts. Unlike LLVM's LoopVectorize pass it also does not have a target-dependent cost heuristics, and we recommend using LoopVectorize instead of -polly-vectorizer=polly.

In the future we hope that Polly can collaborate better with LoopVectorize, like Polly marking a loop is safe to vectorize with a specific simd width, instead of replicating its functionality.

Reviewed By: grosser

Differential Revision: https://reviews.llvm.org/D142640
2023-03-08 12:51:42 -06:00
Paul Walker
62d11b2cca Revert "Revert "[SCEV] Add SCEVType to represent vscale.""
Relanding after fixing Polly related build error.

This reverts commit 7b26dcae9e.
2023-03-02 13:14:07 +00:00
Florian Hahn
934c82d318
[Polly] Remove CodegenCleanupPass.
The pass uses a bunch of deprecated legacy passes and appears unused.
Remove it to unblock removing legacy passes.

Fixes https://github.com/llvm/llvm-project/issues/60852

Reviewed By: Meinersbur

Differential Revision: https://reviews.llvm.org/D144332
2023-02-24 13:39:32 +01:00
Kazu Hirata
a28b252d85 Use APInt::getSignificantBits instead of APInt::getMinSignedBits (NFC)
Note that getMinSignedBits has been soft-deprecated in favor of
getSignificantBits.
2023-02-19 23:56:52 -08:00
Fangrui Song
d7c459070c [LoopIdiomRecognize] Remove legacy pass
Following recent changes to remove non-core legacy passes.
2023-02-19 21:39:47 -08:00
Fangrui Song
f62b084e92 [LoopDeletion] Remove legacy pass
Following recent changes to remove non-core legacy passes.
2023-02-15 23:31:05 -08:00
Arthur Eubanks
84728a3d75 [Inliner] Remove legacy simple inliner
It's part of the optimization pipeline, of which the legacy pass manager version is deprecated.
2023-02-09 10:36:58 -08:00
Archibald Elliott
62c7f035b4 [NFC][TargetParser] Remove llvm/ADT/Triple.h
I also ran `git clang-format` to get the headers in the right order for
the new location, which has changed the order of other headers in two
files.
2023-02-07 12:39:46 +00:00
Michael Kruse
a749e09e18 [Polly] Update ISL to isl-0.25-193-g8621c60c.
The bugfix https://reviews.llvm.org/D142308 might already have been
fixed upstream.
2023-01-25 10:47:37 -06:00
Kazu Hirata
ccdc271a08 [polly] Use std::optional instead of llvm::Optional (NFC)
This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2023-01-02 19:18:46 -08:00
Archibald Elliott
f09cf34d00 [Support] Move TargetParsers to new component
This is a fairly large changeset, but it can be broken into a few
pieces:
- `llvm/Support/*TargetParser*` are all moved from the LLVM Support
  component into a new LLVM Component called "TargetParser". This
  potentially enables using tablegen to maintain this information, as
  is shown in https://reviews.llvm.org/D137517. This cannot currently
  be done, as llvm-tblgen relies on LLVM's Support component.
- This also moves two files from Support which use and depend on
  information in the TargetParser:
  - `llvm/Support/Host.{h,cpp}` which contains functions for inspecting
    the current Host machine for info about it, primarily to support
    getting the host triple, but also for `-mcpu=native` support in e.g.
    Clang. This is fairly tightly intertwined with the information in
    `X86TargetParser.h`, so keeping them in the same component makes
    sense.
  - `llvm/ADT/Triple.h` and `llvm/Support/Triple.cpp`, which contains
    the target triple parser and representation. This is very intertwined
    with the Arm target parser, because the arm architecture version
    appears in canonical triples on arm platforms.
- I moved the relevant unittests to their own directory.

And so, we end up with a single component that has all the information
about the following, which to me seems like a unified component:
- Triples that LLVM Knows about
- Architecture names and CPUs that LLVM knows about
- CPU detection logic for LLVM

Given this, I have also moved `RISCVISAInfo.h` into this component, as
it seems to me to be part of that same set of functionality.

If you get link errors in your components after this patch, you likely
need to add TargetParser into LLVM_LINK_COMPONENTS in CMake.

Differential Revision: https://reviews.llvm.org/D137838
2022-12-20 11:05:50 +00:00
Fangrui Song
53e5cd4d3e llvm::Optional::value => operator*/operator->
std::optional::value() has undesired exception checking semantics and is
unavailable in older Xcode (see _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS). The
call sites block std::optional migration.

This makes `ninja clang` work in the absence of llvm::Optional::value.
2022-12-17 06:37:59 +00:00
Fangrui Song
1da3a795fc JSON: llvm::Optional => std::optional
Many files are from language servers.

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-12-16 07:56:52 +00:00
Vasileios Porpodas
ad8963f344 [NFC] Cleanup: Replace BB->getInstList().erase() with I->eraseFromParent().
This is part of a series of patches that aim at making BasicBlock::getInstList() private.

Differential Revision: https://reviews.llvm.org/D139992
2022-12-13 20:54:30 -08:00
Michael Kruse
6ccd163c1c [Polly] Use std::nullopt to unbreak build. 2022-12-05 17:51:07 -06:00
Nikita Popov
e95ca5bb05 [AST] Make AliasSetTracker work on BatchAA
D138014 restricted AST to work on immutable IR. This means it is
also safe to use a single BatchAA instance for the entire AST
lifetime, instead of only batching parts of individual queries.

The primary motivation for this is not compile-time, but rather
having a central place to control cross-iteration AA, which will
be used by D137958.

Differential Revision: https://reviews.llvm.org/D137955
2022-12-05 08:12:26 +01:00
Fangrui Song
a996cc217c Remove unused #include "llvm/ADT/Optional.h" 2022-12-05 06:31:11 +00:00
Kazu Hirata
043aa1dbba [polly] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-12-03 18:50:29 -08:00
Timm Bäder
e1b88c8a09 [clang] Only use major version in resource dir
This causes unnecessary churn for downstreams.

For the full discussion, see https://discourse.llvm.org/t/should-we-continue-embed-the-full-llvm-version-in-lib-clang/62094

Differential Revision: https://reviews.llvm.org/D125860
2022-11-10 15:02:03 +01:00
Sam James
32a2af44e1 [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
2022-11-08 01:37:04 +00:00
Arthur Eubanks
c7ca01b8d7 [polly] Format RegisterPasses.cpp 2022-10-28 10:25:46 -07:00