4520 Commits

Author SHA1 Message Date
Owen Pan
58323de2e5
[clang-format] Correctly annotate braces in macros (#87953)
Also fix unit tests and reformat polly.

Fixes #86550.
2024-04-09 19:59:36 -07:00
Karthika Devi C
4c6ae8ebb6
[polly] Fix cppcheck SA comments reported in #82263 (#85749)
This patch addresses the (performance )suggestions by checkcpp static
analyzer for couple of files. Here we use const reference for the
suggested function arguments.
Fixes #82263.
2024-04-09 19:51:59 -07:00
Karthika Devi C
601d7eab06
[polly] Add polly-debug flag to print debug info from all parts of polly (#78549)
This flag enable the user to print debug Info from all the passes and
helpers inside polly at once. This will help a novice user as well to
work in polly without explicitly having to know which parts of polly has
actually kicked in and pass them via -debug-only.
2024-03-26 12:02:27 -07:00
Jeremy Morse
b9d83eff25
[NFC][RemoveDIs] Use iterators for insertion at various call-sites (#84736)
These are the last remaining "trivial" changes to passes that use
Instruction pointers for insertion. All of this should be NFC, it's just
changing the spelling of how we identify a position.

In one or two locations, I'm also switching uses of getNextNode etc to
using std::next with iterators. This too should be NFC.

---------

Merged by: Stephen Tozer <stephen.tozer@sony.com>
2024-03-19 16:36:29 +00:00
Jeremy Morse
f33f66be7d [NFC][RemoveDIs] Always use iterators for inserting PHIs
It's becoming potentially unsafe to insert a PHI instruction using a plain
Instruction pointer. Switch all the remaining sites that create and insert
PHIs to use iterators instead. For example, the code in
ComplexDeinterleavingPass.cpp is definitely at-risk of mixing PHIs and
debug-info.
2024-03-05 17:00:12 +00:00
Owen Pan
8de230093f
[clang-format] Correctly annotate braces of empty ctors/dtors (#82097)
Also reformat Polly.

Fixes #79834.
2024-02-19 12:41:22 -08:00
Arthur Eubanks
8d6b451b45 [LegacyPM] Remove legacy LoopRotate pass 2024-02-16 22:12:15 +00:00
Karthika Devi C
0f33c54854
[polly][ScheduleOptimizer] Use IslMaxOperationsGuard helper instead of explicit restoration (#79303)
To fix long compile time issue of Schedule optimizer, patch #77280 sets
the upper cap on max ISL operations. In case of bailing out when ISL
quota is hit, error handling behavior was restored manually. This commit
replaces the restoration code with IslMaxOperationsGuard helper and also
removes redundant early return.
2024-02-14 09:52:47 -08:00
Karthika Devi C
283feb42ee
[polly] Make reduction detection checks more robust - part 2 (#80721)
Existing reduction detection algorithm does two types of memory checks
before marking a load store pair as reduction.
Second check is to verify there is no other memory access in ScopStmt
overlapping with the memory of load and store that forms the reduction.
Existing check misses cases where there could be probable overlap such
as
	A[V] += A[P];
In the above case there is chance of overlap between A[V] and A[P] which
is missed.
This commit addresses this by removing the parameter from space before
checking for compatible space.

Part 1 of this patch :
[75297](https://github.com/llvm/llvm-project/pull/75297)
2024-02-12 13:49:32 -08:00
Stephen Tozer
b5a273a1cf
[Polly][DebugInfo] Use getStableDebugLoc to avoid intrinsic-dependent behaviour (#81246)
Polly currently uses `getDebugLoc` in a few places to produce diagnostic
output; this is correct when interacting with specific instructions, but
may be incorrect when dealing with instruction ranges if debug
intrinsics are included. As a general rule, the debug locations attached
to debug intrinsics may be misleading compared to the surrounding
instructions, and are not generally used for anything other than
determining variable scope info; the recommended approach is therefore
to use `getStableDebugLoc` instead, which skips over debug intrinsics.
This is necessary to fix test failures that occur when enabling
non-instruction debug info, which removes debug intrinsics from basic
blocks and thus alters the diagnostic output of Polly (despite causing
no functional change).
2024-02-09 12:02:59 +00:00
Karthika Devi C
fa3307eb3f
[polly] Make reduction detection checks more robust - part 1 (#75297)
Existing reduction detection algorithm does two types of memory checks
before marking a load store pair as reduction.

First is to check if load and store are pointing to the same memory. This
check right now detects the following case as reduction. sum[0] = sum[1]
+ A[i]

This is because the check compares only base of the memory addresses
involved and not their indices. This patch addresses this issue and
introduces some debug prints. Added couple of test cases to verify the
functionality of patch as well.
2024-01-30 20:20:15 -08:00
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 d6c4d4c9b910e8ad5ed7cd4825a143742041c1f4.

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
Violet Purcell
58689e4318 [polly] [CMake] Create component and install target in add_polly_library (#66598)
Currently there's no component for LLVMPolly and PollyISL, however
they are added to exports whether or not they are installed. This commit
calls add_llvm_install_targets in the add_polly_library function to
allow installation of LLVMPolly and PollyISL via distribution
components, so they can be installed without also installing libPolly.a.

Closes: https://github.com/llvm/llvm-project/pull/66598
2023-12-25 10:31:16 +00: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
Nikita Popov
17168f7f78 [Polly] Add disjoint flag to some tests (NFC) 2023-12-05 14:37:19 +01:00
Brad Smith
12ed2c90a1
[llvm][NFC] A start at cleaning up zero byte files that should have been removed (#74404) 2023-12-05 01:57:14 -05:00
Brad Smith
2fd66e6eb6 Revert "[lldb] A start at cleaning up zero byte files that should have been removed"
This reverts commit 3223936dc512c9f4f87a230a4d2931e37186ca22.

Commited by accident while mixed in with another commit.
2023-12-05 00:27:11 -05:00
Brad Smith
3223936dc5 [lldb] A start at cleaning up zero byte files that should have been removed 2023-12-04 23:12:54 -05:00
Kazu Hirata
e1e34cc2a1
[Support] Remove llvm/Support/Host.h (#74261)
The header file has been deprecated since:

  commit f09cf34d00625e57dea5317a3ac0412c07292148
  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
Philip Reames
f8742b8d6a
[SCEV] Teach SCEVExpander to use zext nneg when possible (#70815)
zext nneg was recently added to the IR in #67982. Teaching SCEVExpander
to emit nneg when possible is valuable since SCEV may have proved
non-trivial facts about loop bounds which would otherwise be lost when
materializing the value.
2023-10-31 09:33:07 -07: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 d68826dfbd98 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
Nikita Popov
4491f0b969 [IR] Remove unnecessary bitcast from CreateMalloc()
This bitcast is no longer necessary with opaque pointers. This
results in some annoying variable name changes in tests.
2023-09-18 14:58:16 +02:00
Jordan Rupprecht
06055d98f0 [polly][www] Remove unused VideoJS
These were added in 2011 in 54da06ca286dc47ae65ba87be439a8c20c685454 and 0d90112195609a85fa96e956ee8b48600d81c13c.

It was then incompletely removed in 2015 in c268835eca8f59b164caa50bdecb7b58415861af: the video itself was removed, but the VideoJS css & script is still loaded.
2023-09-13 12:24:46 -07:00
Marek Sedláček
ebf01690d9 Bug fix for multi-line labels in CFG dot graph
After D154102 multi-line labels would get split incorrectly.
When CFG is generated for a function with basic block name longer
than 80 lines, then the header separator will be placed after the
line break for the label name instead of after the whole label name.
The fix is simple by just moving the insert of | character before the
line splitting happens.

Differential Revision: https://reviews.llvm.org/D159207
2023-09-05 22:01:51 -07: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
Marek Sedláček
3fee76cff3 Headers for basic blocks in CFG dot graphs
This change adds separators for basic block names, which makes it
easier to find a basic block based on its name and separates it
from the code.

Currently there is also a chance that the basic block label will
be present twice, that is in case the basic block has explicit
numbering, this change fixes this bug.

Differential Revision: https://reviews.llvm.org/D154102
2023-08-17 07:55:23 -07:00
Tobias Hieta
4706251a31
Clear release notes for 18.x 2023-07-25 13:58:49 +02: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
Joshua Cao
6ed152aff4 [SCEV] Compute AddRec range computations using different type BECount
Before this patch, we can only use the MaxBECount for an AddRec's range
computation if the MaxBECount has <= bit width of the AddRec. This patch
reasons that if a MaxBECount has > bit width, and is <= the max value of
AddRec's bit width, we can still use the MaxBECount.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D151698
2023-05-31 21:05:17 -07:00
Kazu Hirata
27f7546f33 [polly] Fix typos in documentation 2023-05-27 10:29:20 -07:00
Mark de Wever
cbaa3597aa Reland "[CMake] Bumps minimum version to 3.20.0.
This reverts commit d763c6e5e2d0a6b34097aa7dabca31e9aff9b0b6.

Adds the patch by @hans from
https://github.com/llvm/llvm-project/issues/62719
This patch fixes the Windows build.

d763c6e5e2d0a6b34097aa7dabca31e9aff9b0b6 reverted the reviews

D144509 [CMake] Bumps minimum version to 3.20.0.

This partly undoes D137724.

This change has been discussed on discourse
https://discourse.llvm.org/t/rfc-upgrading-llvms-minimum-required-cmake-version/66193

Note this does not remove work-arounds for older CMake versions, that
will be done in followup patches.

D150532 [OpenMP] Compile assembly files as ASM, not C

Since CMake 3.20, CMake explicitly passes "-x c" (or equivalent)
when compiling a file which has been set as having the language
C. This behaviour change only takes place if "cmake_minimum_required"
is set to 3.20 or newer, or if the policy CMP0119 is set to new.

Attempting to compile assembly files with "-x c" fails, however
this is workarounded in many cases, as OpenMP overrides this with
"-x assembler-with-cpp", however this is only added for non-Windows
targets.

Thus, after increasing cmake_minimum_required to 3.20, this breaks
compiling the GNU assembly for Windows targets; the GNU assembly is
used for ARM and AArch64 Windows targets when building with Clang.
This patch unbreaks that.

D150688 [cmake] Set CMP0091 to fix Windows builds after the cmake_minimum_required bump

The build uses other mechanism to select the runtime.

Fixes #62719

Reviewed By: #libc, Mordante

Differential Revision: https://reviews.llvm.org/D151344
2023-05-27 12:51:21 +02: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
Nico Weber
d763c6e5e2 Revert "Reland "[CMake] Bumps minimum version to 3.20.0.""
This reverts commit 65429b9af6a2c99d340ab2dcddd41dab201f399c.

Broke several projects, see https://reviews.llvm.org/D144509#4347562 onwards.

Also reverts follow-up commit "[OpenMP] Compile assembly files as ASM, not C"

This reverts commit 4072c8aee4c89c4457f4f30d01dc9bb4dfa52559.

Also reverts fix attempt  "[cmake] Set CMP0091 to fix Windows builds after the cmake_minimum_required bump"

This reverts commit 7d47dac5f828efd1d378ba44a97559114f00fb64.
2023-05-17 10:53:33 -04:00
Mark de Wever
65429b9af6 Reland "[CMake] Bumps minimum version to 3.20.0."
The owner of the last two failing buildbots updated CMake.

This reverts commit e8e8707b4aa6e4cc04c0cffb2de01d2de71165fc.
2023-05-13 11:42:25 +02:00
Kazu Hirata
81e149aab9 Replace None with std::nullopt in comments (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-05-12 18:33:26 -07:00
Mark de Wever
e8e8707b4a Revert "Reland "[CMake] Bumps minimum version to 3.20.0.""
Unfortunatly not all buildbots are updated.

This reverts commit ffb807ab5375b3f78df198dc5d4302b3b552242f.
2023-05-06 17:03:56 +02:00