742 Commits

Author SHA1 Message Date
Jeremy Morse
304a99091c [NFC][DebugInfo] Use iterators for insertion at some final callsites
These are the callsites that have materialised in the last three weeks
since I last built with deprecation warnings.
2025-01-28 11:37:11 +00:00
Mats Jun Larsen
d7c14c8f97
[IR] Replace of PointerType::getUnqual(Type) with opaque version (NFC) (#123909)
Follow up to https://github.com/llvm/llvm-project/issues/123569
2025-01-23 18:23:05 +09:00
epitavy
847acbbc52
[ExceptionDemo] Transition example from MCJIT to ORC and fix errors (#92504)
ExceptionDemo has been broken for some time. This patch fixes the
compilation errors and moves the example from MCJIT to ORC.
2025-01-23 12:40:38 +11:00
Lang Hames
81c0f3023f [ORC] Add ExecutorSymbolDef toPtr / fromPtr convenience functions.
This will simplify conversion of a number of APIs from ExecutorAddr to
ExecutorSymbolDef.
2025-01-22 09:53:42 +11:00
AidinT
6f8a363a48
[Kaleidoscope] Add mem2reg pass to function pass manager (#119707)
Kaleidoscope has switched to new pass manager before (#72324), but both
code and tutorial document have some missing parts.

This pull request fixes the following problems:
1. Adds `PromotePass` to the function pass manager. This pass was
removed during the switch from legacy pass manager to the new pass
manager.
2. Syncs the tutorial with the code.
2024-12-12 16:25:09 +01:00
Lang Hames
6410edcb67 [examples] Add missing dependence on OrcShared.
Hopefully this will fix the linker error in
https://lab.llvm.org/buildbot/#/builders/80/builds/7248.
2024-12-06 00:33:45 +00:00
Lang Hames
dc11c06015 [ORC] Move absoluteSymbols from Core.h to new AbsoluteSymbols.h header. NFC.
Continuing Core.h clean-up.

If you see any errors about a missing absoluteSymbols function you need to
include the new AbsoluteSymbols.h header.
2024-11-11 11:39:53 +11:00
Lang Hames
e575483870 [ORC] Fix LLJITWithRemoteDebugging example after db21bd4fa9b. 2024-10-22 11:31:54 -07:00
Sunho Kim
04af63b267 [ORC] Introduce IRPartitionLayer for common partition functionality. 2024-10-12 01:21:05 +09:00
Rahul Joshi
fa789dffb1
[NFC] Rename Intrinsic::getDeclaration to getOrInsertDeclaration (#111752)
Rename the function to reflect its correct behavior and to be consistent
with `Module::getOrInsertFunction`. This is also in preparation of
adding a new `Intrinsic::getDeclaration` that will have behavior similar
to `Module::getFunction` (i.e, just lookup, no creation).
2024-10-11 05:26:03 -07:00
Jeremy Morse
2f50b280dc
[DebugInfo] Enable deprecation of iterator-insertion methods (#102608)
This is an almost-final step in eliminating debug-intrinsics -- read more
about that here: https://llvm.org/docs/RemoveDIsDebugInfo.html . To
correctly update variable location information in the background when
inserting instructions, we need some information carried at runtime in
BasicBlock::iterator, hence deprecating pointer-insertion.
                                                                                                                                                                                                                 An immediate fix for any deprecation warnings is to call "getIterator"
on the insertion position pointer. If you intend on inserting at the start
of a block, use BB->begin() or similar methods to fetch the appropriate
iterator.
2024-09-20 13:56:43 +01:00
c8ef
4f4bd41f70
[NFC] Fix typos (#106817)
Fixes #106761.
2024-08-31 19:12:57 -07:00
Bjorn Pettersson
145aff6d92 Clean up pointer casts etc after opaque pointers transition. NFC (#102631) 2024-08-12 13:28:53 +02:00
Steven Wu
01b488faab
Reapply "[CMake] Fold export_executable_symbols_* into function args. (#101741)" (#102138)
Fix the builds with LLVM_TOOL_LLVM_DRIVER_BUILD enabled.

LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES is not completely
compatible with export_executable_symbols as the later will be ignored
if the previous is set to NO.

Fix the issue by passing if symbols need to be exported to
llvm_add_exectuable so the link flag can be determined directly
without calling export_executable_symbols_* later.
2024-08-07 09:12:15 -07:00
Steven Wu
f9b69a378c Revert "[CMake] Fold export_executable_symbols_* into function args. (#101741)"
This reverts commit 5c56b46a32a8856a022a54291bc9294068f7ddbd. This break
lld build when using GENERATE_DRIVER.
2024-08-06 06:08:16 -07:00
Steven Wu
5c56b46a32
[CMake] Fold export_executable_symbols_* into function args. (#101741)
`LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES` is not completely
compatible with `export_executable_symbols` as the later will be ignored
if the previous is set to NO.

 Fix the issue by passing if symbols need to be exported to
`llvm_add_exectuable` so the link flag can be determined directly
without calling `export_executable_symbols_*` later.
2024-08-05 19:08:27 -07:00
FantasqueX
2d21851fd5
[llvm] Remove useless headers in example BrainF (#93701) 2024-06-08 21:33:43 +08:00
Michael Kruse
4ecbfacf9e
[llvm] Revise IDE folder structure (#89741)
Update the folder titles for targets in the monorepository that have not
seen taken care of for some time. These are the folders that targets are
organized in Visual Studio and XCode
(`set_property(TARGET <target> PROPERTY FOLDER "<title>")`)
when using the respective CMake's IDE generator.

 * Ensure that every target is in a folder
 * Use a folder hierarchy with each LLVM subproject as a top-level folder
 * Use consistent folder names between subprojects
 * When using target-creating functions from AddLLVM.cmake, automatically
deduce the folder. This reduces the number of
`set_property`/`set_target_property`, but are still necessary when
`add_custom_target`, `add_executable`, `add_library`, etc. are used. A
LLVM_SUBPROJECT_TITLE definition is used for that in each subproject's
root CMakeLists.txt.
2024-05-25 13:28:30 +02:00
Alex Voicu
10edb4991c
[Clang][CodeGen] Start migrating away from assuming the Default AS is 0 (#88182)
At the moment, Clang is rather liberal in assuming that 0 (and by extension unqualified) is always a safe default. This does not work for targets that actually use a different value for the default / generic AS (for example, the SPIRV that obtains from HIPSPV or SYCL). This patch is a first, fairly safe step towards trying to clear things up by querying a modules' default AS from the target, rather than assuming it's 0, alongside fixing a few places where things break / we encode the 0 == DefaultAS assumption. A bunch of existing tests are extended to check for non-zero default AS usage.
2024-05-19 14:59:03 +01:00
Kamlesh Kumar
b59760d83d
Revert "[ExceptionDemo] Correct and update example ExceptionDemo" (#92257)
Reverts llvm/llvm-project#69485
2024-05-15 18:57:49 +05:30
epitavy
2ece5cc2bb
[ExceptionDemo] Correct and update example ExceptionDemo (#69485)
The ExceptionDemo example was no longer compiling (since llvm 14 at
least). The PR makes the example work with the current API and also
transition from MCJIT to ORC.
Fixes #63702
2024-05-15 08:39:11 +05:30
Nikita Popov
47682e4b4a Revert "[ORC] Implement basic reoptimization. (#67050)"
This reverts commit 0d288e5b0ccf217e41944ad4fd8772d8ae45daa1.

Breaks the build.
2024-04-26 14:47:48 +09:00
Sunho Kim
0d288e5b0c
[ORC] Implement basic reoptimization. (#67050) 2024-04-25 22:43:06 -07:00
Lang Hames
e400e908b2 [ORC] Fix SpeculativeJIT example after 7da63426ac5 (ORC dispatch unification).
Fixes the bot failure at
https://lab.llvm.org/buildbot/#/builders/272/builds/14788.

Coding my way home: 6.48551S, 128.21109W
2024-04-24 01:03:29 -08:00
Lang Hames
69703b1f94 [ORC] Fix bot failure due to 7da63426ac5 (ORC task dispatch unification).
Fixes the failure at https://lab.llvm.org/buildbot/#/builders/131/builds/62928,
and add comments about unused variable and update debugging output.

Coding my way home: 6.44615S, 128.16704W
2024-04-24 00:24:16 -08:00
Mehdi Amini
716042a63f
Rename llvm::ThreadPool -> llvm::DefaultThreadPool (NFC) (#83702)
The base class llvm::ThreadPoolInterface will be renamed
llvm::ThreadPool in a subsequent commit.

This is a breaking change: clients who use to create a ThreadPool must
now create a DefaultThreadPool instead.
2024-03-05 18:00:46 -08:00
Jeremy Morse
df52521655 [RemoveDIs] Follow up to 6b62a9135a2, fix a ICmpInst constructor call
Seemingly I either missed this on a buildbot or otherwise didn't
cover this :(
2024-03-04 19:31:42 +00:00
Jeremy Morse
46d7876957 Follow up to 6b62a9135a2, fix llvm-examples build
This is due to the {I,F}CmpInst constructor being normalised to take a
pointer to a block rather than a reference (unlike any other Instruction).
2024-03-04 13:41:26 +00:00
Gonsolo
33aaad9427
[Kaleidoscope] LLVM is not needed for chapter two (#69823)
Since the example (llvm/examples/Kaleidoscope/Chapter2/toy.cpp) is
self-contained there is no need to use LLVM.
2024-01-12 20:48:43 -08:00
Stefan Gränitz
b7d5b0d0ee
[Orc][examples] Revisit advanced LLJIT examples and tests (#76236)
Some maintenance on implementation and tests:
* Drop manual TargetMachineBuilder setup
* Drop addDebugSupport() in favor of Orc's enableDebuggerSupport()
* Check that debug support plugins append jit_code_entry
* Update and reduce sample input
2024-01-03 09:51:18 +01:00
Stefan Gränitz
d86a93782f
[Orc][examples] Drop target triple from input for remote debugging test (#74831)
https://github.com/llvm/llvm-project/pull/74764 reported that the
`lljit-with-remote-debugging` test fails on AArch64 hosts, because the
input IR file states arch x86_64 explicitly. In order to drop the target
triple we have to remove a check in the example implementation.

Not sure it's fully portable now, but at least it's better than before.
2023-12-08 22:10:03 +01:00
Fangrui Song
114325b86a Kaleidoscope-Ch8: use Reloc::PIC_
which has better portability across different OSes.
In addition, on many ELF OSes, this output relocatable file can be
linked without -no-pie.
2023-12-05 23:44:35 -08:00
Fangrui Song
dd3184c30f [unittest,examples] Replace uses of IRBuilder::getInt8PtrTy with getPtrTy. NFC 2023-11-27 08:29:13 -08:00
Logikable
3d2527ebe3
[Kaleidoscope] Switch to the new PassManager, revisited. (#72324)
Rollforward of #69032, which was reverted in
[63d19cf](63d19cfd85).

New: implemented changes in
https://github.com/llvm/llvm-project/pull/69032#issuecomment-1809250162.
Given the PassBuilder is how we expect users to register passes, the
tutorial should reflect that.
2023-11-16 09:13:56 -08:00
Amara Emerson
63d19cfd85 Revert "[Kaleidoscope] Switch to the new PassManager. (#69032)"
This reverts commit 7b94744e77aaf752abc2c6ab38ee3fdfafbeff9d.

This breaks the expensive checks bot: https://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-expensive/26026/

We didn't notice because it was broken for other reasons I think.
2023-11-13 14:38:14 -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
Logikable
b8b7c3ba5c
[Kaleidoscope] Register new dependencies introduced by #69032. (#69510)
Broke https://lab.llvm.org/buildbot/#/builders/181/builds/24470.

Could we build the example/tutorial code in the submit checks? This
breakage wasn't caught at submit time.
2023-10-18 14:18:34 -07:00
Logikable
7b94744e77
[Kaleidoscope] Switch to the new PassManager. (#69032)
Using the new pass manager is more verbose; let me know if the tutorial
doesn't flow well with all the additions.
2023-10-18 09:25:50 -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
Jie Fu
da57ced76d [examples] Remove unused variable 'BB' in BrainF.cpp (NFC)
/Users/jiefu/llvm-project/llvm/examples/BrainF/BrainF.cpp:92:15: error: unused variable 'BB' [-Werror,-Wunused-variable]
  BasicBlock* BB = builder->GetInsertBlock();
              ^
1 error generated.
2023-09-19 15:46:08 +08: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
Arthur Eubanks
0a1aa6cda2
[NFC][CodeGen] Change CodeGenOpt::Level/CodeGenFileType into enum classes (#66295)
This will make it easy for callers to see issues with and fix up calls
to createTargetMachine after a future change to the params of
TargetMachine.

This matches other nearby enums.

For downstream users, this should be a fairly straightforward
replacement,
e.g. s/CodeGenOpt::Aggressive/CodeGenOptLevel::Aggressive
or s/CGFT_/CodeGenFileType::
2023-09-14 14:10:14 -07:00
Lang Hames
d467396ae0 [emamples][OrcV2Examples] Fix a missing newline in LLJITRemovableCode output. 2023-07-30 08:51:42 -07:00
Jie Fu
c2cabe479b [examples] Fix -Wcast-qual in OrcV2Examples after D153911 (NFC)
/Users/jiefu/llvm-project/llvm/examples/OrcV2Examples/OrcV2CBindingsBasicUsage/OrcV2CBindingsBasicUsage.c:77:52: error: cast from 'char **' to 'const char **' must have all intermediate pointers const qualified to be safe [-Werror,-Wcast-qual]
  LLVMParseCommandLineOptions(argc, (const char **)argv, "");
                                                   ^
/Users/jiefu/llvm-project/llvm/examples/OrcV2Examples/OrcV2CBindingsAddObjectFile/OrcV2CBindingsAddObjectFile.c:63:52: error: cast from 'char **' to 'const char **' must have all intermediate pointers const qualified to be safe [-Werror,-Wcast-qual]
  LLVMParseCommandLineOptions(argc, (const char **)argv, "");
                                                   ^
/Users/jiefu/llvm-project/llvm/examples/OrcV2Examples/OrcV2CBindingsDumpObjects/OrcV2CBindingsDumpObjects.c:62:52: error: cast from 'char **' to 'const char **' must have all intermediate pointers const qualified to be safe [-Werror,-Wcast-qual]
  LLVMParseCommandLineOptions(argc, (const char **)argv, "");
                                                   ^
...
2023-07-19 14:55:58 +08:00
Carlo Bramini
a6ea0185d6 [llvm] CYGWIN: Fix build of some plugins/library/unittests
CYGWIN uses the same format of WIN32 for shared libraries.
As the comment says: "a shared library can't have undefined references", in this case CYGWIN must be handled like WIN32 by CMakeLists.txt, otherwise you will get several errors when linking because some symbols are undefined.
Attached patch fixes this issue and allows to complete the build process for those targets.

Differential Revision: https://reviews.llvm.org/D154794
2023-07-10 22:43:03 +03: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
Lang Hames
13f5125f9d [tutorials] Add missing ExecutorSymbolDef header.
Similar to c118d05f9ed, but applied to the base Kaleidoscope series.
2023-06-21 08:51:17 -07:00
Lang Hames
c118d05f9e [tutorials][BuildingAJIT] Add missing ExecutorSymbolDef header. 2023-06-21 08:35:37 -07:00
Lang Hames
d120d77f72 [ORC] Simplify construction of EPCIndirectionUtils.
ExecutionSessions always have an ExecutorProcessControl object now, so we can
construct EPCIndirectionUtil objects directly from an ExecutionSession.
2023-06-07 16:28:07 -07:00
Tobias Hieta
b71edfaa4e
[NFC][Py Reformat] Reformat python files in llvm
This is the first commit in a series that will reformat
all the python files in the LLVM repository.

Reformatting is done with `black`.

See more information here:

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

Reviewed By: jhenderson, JDevlieghere, MatzeB

Differential Revision: https://reviews.llvm.org/D150545
2023-05-17 10:48:52 +02:00