about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/builder.rs
AgeCommit message (Collapse)AuthorLines
2022-10-20Don't use usub.with.overflow intrinsicNikita Popov-5/+8
The canonical form of a usub.with.overflow check in LLVM are separate sub + icmp instructions, rather than a usub.with.overflow intrinsic. Using usub.with.overflow will generally result in worse optimization potential. The backend will attempt to form usub.with.overflow when it comes to actual instruction selection. This is not fully reliable, but I believe this is a better tradeoff than using the intrinsic in IR. Fixes #103285.
2022-10-02Remove type argument of array_alloca and rename to byte_array_allocabjorn3-2/+3
2022-10-02Remove dynamic_alloca from BuilderMethodsbjorn3-5/+1
2022-10-01Merge apply_attrs_callsite into call and invokebjorn3-4/+15
Some codegen backends are not able to apply callsite attrs after the fact.
2022-09-18Use LLVM C-API to build atomic cmpxchg and fenceJosh Stone-10/+16
2022-09-01Always import all tracing macros for the entire crate instead of piecemeal ↵Oli Scherer-1/+0
by module
2022-08-16Move the cast_float_to_int fallback code to GCCJosh Stone-9/+4
Now that we require at least LLVM 13, that codegen backend is always using its intrinsic `fptosi.sat` and `fptoui.sat` conversions, so it doesn't need the manual implementation. However, the GCC backend still needs it, so we can move all of that code down there.
2022-08-14Update the minimum external LLVM to 13Josh Stone-54/+25
2022-07-23Add fine-grained LLVM CFI support to the Rust compilerRamon de C Valle-26/+0
This commit improves the LLVM Control Flow Integrity (CFI) support in the Rust compiler by providing forward-edge control flow protection for Rust-compiled code only by aggregating function pointers in groups identified by their return and parameter types. Forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space) will be provided in later work as part of this project by identifying C char and integer type uses at the time types are encoded (see Type metadata in the design document in the tracking issue #89653). LLVM CFI can be enabled with -Zsanitizer=cfi and requires LTO (i.e., -Clto).
2022-07-05Prefer trace level instrumentation for the new noisy instrument attributesOli Scherer-1/+1
2022-06-29Some tracing cleanupsOli Scherer-3/+3
2022-06-22Work around llvm 12's memory ordering restrictions.Mara Bos-1/+15
Older llvm has the pre-C++17 restriction on success and failure memory ordering, requiring the former to be at least as strong as the latter. So, for llvm 12, this upgrades the success ordering to a stronger one if necessary.
2022-05-25Don't use global initializer if type does not matchNikita Popov-2/+7
This was relying on the presence of a bitcast to avoid using the constant global initializer for a load using a different type. With opaque pointers, we need to check this explicitly.
2022-05-20Remove `crate` visibility usage in compilerJacob Pratt-1/+1
2022-04-05Mark scalar layout unions so that backends that do not support partially ↵Oli Scherer-4/+4
initialized scalars can special case them.
2022-04-03Replace every `String` in Target(Options) with `Cow<'static, str>`Loïc BRANSTETT-1/+1
2022-03-04Auto merge of #94159 - erikdesjardins:align-load, r=nikicbors-8/+30
Add !align metadata on loads of &/&mut/Box Note that this refers to the alignment of what the loaded value points to, _not_ the alignment of the loaded value itself. r? `@ghost` (blocked on #94158)
2022-03-01Auto merge of #94402 - erikdesjardins:revert-coldland, r=nagisabors-14/+3
Revert "Auto merge of #92419 - erikdesjardins:coldland, r=nagisa" Should fix (untested) #94390 Reopens #46515, #87055 r? `@ehuss`
2022-02-28Add !align metadata on loads of &/&mut/BoxErik Desjardins-8/+30
Note that this refers to the alignment of what the loaded value points to, _not_ the alignment of the loaded value itself.
2022-02-27Revert "Auto merge of #92419 - erikdesjardins:coldland, r=nagisa"Erik Desjardins-14/+3
This reverts commit 4f49627c6fe2a32d1fed6310466bb0e1c535c0c0, reversing changes made to 028c6f1454787c068ff5117e9000a1de4fd98374.
2022-02-27Apply noundef metadata to loads of types that do not permit raw initErik Desjardins-0/+14
This matches the noundef attributes we apply on arguments/return types.
2022-02-26Add LLVM attributes in batches instead of individuallyErik Desjardins-2/+8
This should improve performance.
2022-02-24Introduce Bx::switch_to_blockbjorn3-0/+4
2022-02-20Remove build_sibling_blockbjorn3-13/+11
2022-01-24Merge landing_pad and set_cleanup into cleanup_landing_padbjorn3-16/+18
2022-01-24Merge add_handler into catch_switchbjorn3-8/+8
Some codegen backends may require all handlers to be immediately known
2022-01-24Remove unused return values from resume and cleanup_retbjorn3-10/+9
Given that these instructions are diverging, not every codegen backend may be able to produce a return value for them.
2022-01-24Reorder unwinding related builder methods to differentiate between dwarf and ↵bjorn3-6/+6
msvc instructions
2022-01-17Update compiler/rustc_codegen_llvm/src/builder.rsCaleb Zulawski-3/+3
Co-authored-by: Jubilee <46493976+workingjubilee@users.noreply.github.com>
2022-01-04Add simd_as intrinsicCaleb Zulawski-18/+41
2021-12-30keep noinline for system llvm < 14Erik Desjardins-1/+8
2021-12-29Mark drop calls in landing pads cold instead of noinlineErik Desjardins-2/+2
Now that deferred inlining has been disabled in LLVM, this shouldn't cause catastrophic size blowup.
2021-12-16Remove `in_band_lifetimes` from `rustc_codegen_llvm`LegionMammal978-12/+12
See #91867 for more information.
2021-11-10Use more robust checks in rustc for wasmAlex Crichton-2/+2
2021-11-10Update more rustc/libtest things for wasm64Alex Crichton-2/+2
* Add wasm64 variants for inline assembly along the same lines as wasm32 * Update a few directives in libtest to check for `target_family` instead of `target_arch` * Update some rustc codegen and typechecks specialized for wasm32 to also work for wasm64.
2021-11-05Remove some minor checks for LLVM < 12Josh Stone-2/+2
2021-10-27Auto merge of #89652 - rcvalle:rust-cfi, r=nagisabors-0/+26
Add LLVM CFI support to the Rust compiler This PR adds LLVM Control Flow Integrity (CFI) support to the Rust compiler. It initially provides forward-edge control flow protection for Rust-compiled code only by aggregating function pointers in groups identified by their number of arguments. Forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space) will be provided in later work as part of this project by defining and using compatible type identifiers (see Type metadata in the design document in the tracking issue #89653). LLVM CFI can be enabled with -Zsanitizer=cfi and requires LTO (i.e., -Clto). Thank you, `@eddyb` and `@pcc,` for all the help!
2021-10-25Add LLVM CFI support to the Rust compilerRamon de C Valle-0/+26
This commit adds LLVM Control Flow Integrity (CFI) support to the Rust compiler. It initially provides forward-edge control flow protection for Rust-compiled code only by aggregating function pointers in groups identified by their number of arguments. Forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space) will be provided in later work as part of this project by defining and using compatible type identifiers (see Type metadata in the design document in the tracking issue #89653). LLVM CFI can be enabled with -Zsanitizer=cfi and requires LTO (i.e., -Clto).
2021-10-12Remap ssa RealPredicate to llvm RealPredicateTomasz Miąsko-0/+1
to avoid relying on the discriminant of the former for FFI purposes
2021-10-01Fix clippy lintsGuillaume Gomez-1/+1
2021-09-18Querify `fn_abi_of_{fn_ptr,instance}`.Eduard-Mihai Burtescu-1/+1
2021-09-18ty::layout: replicate `layout_of` setup for `fn_abi_of_{fn_ptr,instance}`.Eduard-Mihai Burtescu-2/+18
2021-09-09rename `is_valid_for` to `is_valid`Andreas Liljeqvist-1/+1
2021-09-09Make `abi::Abi` `Copy` and remove a *lot* of refsAndreas Liljeqvist-7/+7
fix fix Remove more refs and clones fix more fix
2021-09-09Remove `contains_zero`, respect the compilerAndreas Liljeqvist-1/+1
2021-09-09Add methods for checking for full ranges to `Scalar` and `WrappingRange`Andreas Liljeqvist-7/+6
Move *_max methods back to util change to inline instead of inline(always) Remove valid_range_exclusive from scalar Use WrappingRange instead implement always_valid_for in a safer way Fix accidental edit
2021-09-02ty::layout: split `LayoutOf` into required and (blanket) provided halves.Eduard-Mihai Burtescu-2/+2
2021-09-02ty::layout: implement `layout_of` automatically as a default method.Eduard-Mihai Burtescu-3/+4
2021-09-02rustc_target: move `LayoutOf` to `ty::layout`.Eduard-Mihai Burtescu-5/+4
2021-08-27rustc_target: add lifetime parameter to `LayoutOf`.Eduard-Mihai Burtescu-1/+1