about summary refs log tree commit diff
path: root/src/rustllvm/PassWrapper.cpp
AgeCommit message (Collapse)AuthorLines
2020-03-19Fix timeTraceProfilerInitialize for LLVM 10Nikita Popov-1/+5
2020-03-03Invoke OptimizerLastEPCallbacks in PreLinkThinLTOTomasz Miąsko-2/+10
The default ThinLTO pre-link pipeline does not include optimizer last extension points. Thus, when using the new LLVM pass manager & ThinLTO & sanitizers on any opt-level different from zero, the sanitizer function passes would be omitted from the pipeline. Add optimizer last extensions points manually to the pipeline, but guard registration with stage check in the case this behaviour changes in the future.
2020-02-13Auto merge of #69144 - Dylan-DPC:rollup-apt6zjj, r=Dylan-DPCbors-2/+2
Rollup of 9 pull requests Successful merges: - #68728 (parse: merge `fn` syntax + cleanup item parsing) - #68938 (fix lifetime shadowing check in GATs) - #69057 (expand: misc cleanups and simplifications) - #69108 (Use HirId in TraitCandidate.) - #69125 (Add comment to SGX entry code) - #69126 (miri: fix exact_div) - #69127 (Enable use after scope detection in the new LLVM pass manager) - #69135 (Spelling error "represening" to "representing") - #69141 (Don't error on network failures) Failed merges: r? @ghost
2020-02-13add selfprofiling for new llvm passmanagerAndreas Jonson-1/+64
2020-02-13Enable use after scope detection in the new LLVM pass managerTomasz Miąsko-2/+2
Implementation of 08a1c566a792dcf9657d293155f7ada87746bb65 for the new LLVM pass manager, support for which landed in the meantime.
2020-02-12Add support for new pass managerNikita Popov-1/+243
The new pass manager can be enabled using -Z new-llvm-pass-manager=on.
2020-02-01Add support for enabling the LLVM time-trace featureWesley Wiser-0/+18
I found this helpful while investigating an LLVM performance issue. Passing `-Z llvm-time-trace` causes a `llvm_timings.json` file to be created. This file can be inspected in either the Chrome Profiler tools or with any other compatible tool like SpeedScope. More information on the LLVM feature: - https://aras-p.info/blog/2019/01/16/time-trace-timeline-flame-chart-profiler-for-Clang/ - https://reviews.llvm.org/rL357340
2020-01-27Detect use-after-scope bugs with AddressSanitizerTomasz Miąsko-1/+2
Enable use-after-scope checks by default when using AddressSanitizer. They allow to detect incorrect use of stack objects after their scope have already ended. The detection is based on LLVM lifetime intrinsics. To facilitate the use of this functionality, the lifetime intrinsics are now emitted regardless of optimization level if enabled sanitizer makes use of them.
2020-01-07Update thinLTOInternalizeAndPromoteInIndex() usageNikita Popov-0/+10
2020-01-07Handle removal of llvm::make_unique()Nikita Popov-0/+8
2020-01-07CodeGenFileType moved outside TargetMachineNikita Popov-0/+13
2020-01-07Explicitly include InitializePasses.hNikita Popov-0/+1
2019-12-05Auto merge of #66952 - 0dvictor:print, r=rkruppebors-40/+3
Use Module::print() instead of a PrintModulePass llvm::Module has a print() method. It is unnecessary to create a pass just for the purpose of printing LLVM IR.
2019-12-03Rollup merge of #66973 - cuviper:min-llvm7, r=alexcrichtonMazdak Farrokhzad-13/+3
Update the minimum external LLVM to 7 LLVM 7 is over a year old, which should be plenty for compatibility. The last LLVM 6 holdout was llvm-emscripten, which went away in #65501. I've also included a fix for LLVM 8 lacking `MemorySanitizerOptions`, which was broken by #66522.
2019-12-03Change linker for x86_64-fortanix-unknown-sgx to rust-lldParth Sane-1/+3
For SGX, the relocation using the relocation table is done by the code in rust/src/libstd/sys/sgx/abi/reloc.rs and this code should not require relocation. Setting RelaxELFRelocations flag if allows this to happen, hence adding a Target Option for it.
2019-12-02Update the minimum external LLVM to 7Josh Stone-13/+3
LLVM 7 is over a year old, which should be plenty for compatibility. The last LLVM 6 holdout was llvm-emscripten, which went away in #65501. I've also included a fix for LLVM 8 lacking `MemorySanitizerOptions`, which was broken by #66522.
2019-12-02Use Module::print() instead of a PrintModulePassVictor Ding-40/+3
llvm::Module has a print() method. It is unnecessary to create a pass just for the purpose of printing LLVM IR.
2019-11-29Use LLVMAddAnalysisPasses instead of Rust's wrapperVictor Ding-11/+0
LLVM exposes a C API `LLVMAddAnalysisPasses` and hence Rust's own wrapper `LLVMRustAddAnalysisPasses` is not needed anymore.
2019-11-27Rollup merge of #66761 - yuyoyuppe:rust_llvm_minor_fix, r=alexcrichtonTyler Mandry-1/+1
Use LLVMDisposePassManager instead of raw delete in rustllvm LLVM has a dedicated API call which wraps the destructor invocation for the PassManager. Rust invokes it [otherwhere](https://github.com/rust-lang/rust/blob/d63b24ffcc48f44ef09e0369e6516d6f2dec3520/src/librustc_codegen_llvm/back/write.rs#L446-L447), but not in the `LLVMRustWriteOutputFile`. Since `LLVMDisposePassManager` might be extended to perform additional cleanup actions in the future, this change replaces raw destructor invocation with that API call.
2019-11-25Use LLVMDisposePassManager instead of raw delete in rustllvmyuyoyuppe-1/+1
2019-11-22Retain compatibility with LLVM 6, 7, 8 and 9Tomasz Miąsko-4/+21
2019-11-22Move sanitizer passes creation from ssa to llvmTomasz Miąsko-0/+26
2019-11-06Rollup merge of #66062 - smaeul:patch/pic-level, r=estebankMazdak Farrokhzad-0/+4
Configure LLVM module PIC level As of LLVM 9, this is required for 32-bit PowerPC to properly generate PLT references. Previously, only BigPIC was supported; now LLVM supports both BigPIC and SmallPIC, and there is no default value provided.
2019-11-03Configure LLVM module PIC levelSamuel Holland-0/+4
As of LLVM 9, this is required for 32-bit PowerPC to properly generate PLT references. Previously, only BigPIC was supported; now LLVM supports both BigPIC and SmallPIC, and there is no default value provided.
2019-10-29Allow specifying key "llvm-abiname" in target specificationGui Andrade-1/+2
This addresses #65024, as it allows RISC-V target specification files to set "llvm-abiname": "lp64d". In general, it is useful for the programmer to be able to set this codegen parameter, which other languages usually expose under a compiler argument like "-mabi=<XYZ>".
2019-07-20Don't link mcjit/interpreter LLVM componentsNikita Popov-2/+0
2019-07-15Don't add extra passes into the function pass managerNikita Popov-0/+17
Exception for specific cases like linting, additional passes should be going into the module pass manager (even if they are function passes). The separate function pass manager is only used for very early optimization passes. Rather than apparending passes to the MPM, use the OptimizerLast and EnabledOnOptLevel0 pass manager builder extension hooks, which allow adding passes directly before finalization (alias canonicalization and name-anon-globals). The main effect and purpose of this change is to add sanitizer passes at the end of the pipeline, which is where they belong. In LLVM 9 the address sanitizer can't be used as a pass in the early function pass manager, because it has a dependence on a module-level analysis pass.
2019-07-13Update CPU printing for SubtargetSubTypeKVNikita Popov-4/+4
CPUs now use SubtargetSubTypeKV rather than SubtargetFeatureKV and no longer have a description.
2019-07-09Pass GUIDPreservedSymbols to thinLTOResolvePrevailingInIndex()Nikita Popov-1/+4
2019-04-26Limit internalization in LLVM 8 ThinLTOJosh Stone-1/+4
2019-04-05Show better errors for LLVM IR outputJosh Stone-2/+9
I was trying to output LLVM IR directly to the console: $ rustc hello.rs --emit=llvm-ir -o /dev/stdout LLVM ERROR: IO failure on output stream: Bad file descriptor Now `LLVMRustPrintModule` returns an error, and we print: error: failed to write LLVM IR to /dev/stdout.hello.7rcbfp3g-cgu.0.rcgu.ll: Permission denied ... which is more informative.
2019-02-12rustc: Implement incremental "fat" LTOAlex Crichton-4/+4
Currently the compiler will produce an error if both incremental compilation and full fat LTO is requested. With recent changes and the advent of incremental ThinLTO, however, all the hard work is already done for us and it's actually not too bad to remove this error! This commit updates the codegen backend to allow incremental full fat LTO. The semantics are that the input modules to LTO are all produce incrementally, but the final LTO step is always done unconditionally regardless of whether the inputs changed or not. The only real incremental win we could have here is if zero of the input modules changed, but that's so rare it's unlikely to be worthwhile to implement such a code path. cc #57968 cc rust-lang/cargo#6643
2019-01-25Rebase to the llvm-project monorepoJosh Stone-1/+6
The new git submodule src/llvm-project is a monorepo replacing src/llvm and src/tools/{clang,lld,lldb}. This also serves as a rebase for these projects to the new 8.x branch from trunk. The src/llvm-emscripten fork is unchanged for now.
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-09Bump minimum required LLVM version to 6.0Nikita Popov-16/+2
2018-11-30Enable -mergefunc-use-aliasesNikita Popov-1/+1
If the Rust LLVM fork is used, enable the -mergefunc-use-aliases flag, which will create aliases for merged functions, rather than inserting a call from one to the other. A number of codegen tests needed to be adjusted, because functions that previously fell below the thunk limit are now being merged. Merging is prevented either using -C no-prepopulate-passes, or by making the functions non-identical. I expect that this is going to break something, somewhere, because it isn't able to deal with aliases properly, but we won't find out until we try :) This fixes #52651.
2018-11-25Handle some renamed ThinLTO functionsAlex Crichton-0/+8
2018-11-11Auto merge of #55698 - nikic:remove-llvm-4-support, r=alexcrichtonbors-40/+1
Remove support for building against LLVM 4 With emscripten removed in #55626, we no longer need to support building against LLVM 4.
2018-11-10Auto merge of #55626 - nikic:update-emscripten, r=alexcrichtonbors-1/+1
Update emscripten This updates emscripten to 1.38.15, which is based on LLVM 6.0.1 and would allow us to drop code for handling LLVM 4. The main issue I ran into is that exporting statics through `EXPORTED_FUNCTIONS` no longer works. As far as I understand exporting non-functions doesn't really make sense under emscripten anyway, so I've modified the symbol export code to not even try. Closes #52323.
2018-11-05Remove support for building against LLVM 4Nikita Popov-40/+1
With emscripten removed in #55626, we no longer need to support building against LLVM 4.
2018-11-04Update llvm-emscriptenNikita Popov-1/+1
This updates emscripten to version 1.38.15, which is based on LLVM 6.0.1.
2018-11-01Remove checks for LLVM < 4.0Nikita Popov-142/+0
While we still have to support LLVM 4.0 for Emscripten, we can drop checks for LLVM >= 4.0 and < 4.0.
2018-09-26add -Z emit-stack-sizesJorge Aparicio-1/+4
2018-08-31Provide a way of accessing the ThinLTO module import map in rustc.Michael Woerister-0/+27
2018-08-28Fix warnings about the `native` target-cpuAlex Crichton-6/+7
This fixes a regression from #53031 where specifying `-C target-cpu=native` is printing a lot of warnings from LLVM about `native` being an unknown CPU. It turns out that `native` is indeed an unknown CPU and we have to perform a mapping to an actual CPU name, but this mapping is only performed in one location rather than all locations we inform LLVM about the target CPU. This commit centralizes the mapping of `native` to LLVM's value of the native CPU, ensuring that all locations we inform LLVM about the `target-cpu` it's never `native`. Closes #53322
2018-08-19Buffer LLVM's object output streamAlex Crichton-1/+2
In some profiling on OSX I saw the `write` syscall as quite high up on the profiling graph, which is definitely not good! It looks like we're setting the output stream of an object file as directly to a file descriptor which means that we run the risk of doing lots of little writes rather than a few large writes. This commit fixes this issue by adding a buffered stream on the output, causing the `write` syscall to disappear from the profiles on OSX.
2018-08-12Make LLVM emit assembly comments with -Z asm-comments.whitequark-1/+4
Fixes #35741.
2018-08-01[RISCV] Enable LLVM backend.David Craven-1/+8
2018-08-01Rollup merge of #52824 - varkor:fix-llvm-ret-move-warnings, r=rkruppePietro Albini-3/+3
Fix -Wpessimizing-move warnings in rustllvm/PassWrapper These are producing warnings when building rustc (`warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move]`).
2018-07-30rustc_codegen_llvm: remove more unused functions.Irina Popa-24/+0