#
b12a864c |
| 25-Oct-2021 |
Duncan P. N. Exon Smith <dexonsmith@apple.com> |
Bitcode: Use Expected<T>::takeError() and moveInto() more, NFC
Avoid naming some Expected<T> values in the Bitcode reader by using takeError() and moveInto() more often. This follows the smaller set
Bitcode: Use Expected<T>::takeError() and moveInto() more, NFC
Avoid naming some Expected<T> values in the Bitcode reader by using takeError() and moveInto() more often. This follows the smaller set of changes included in 2410fb4616b2c08bbaddd44e6c11da8285fbd1d3.
show more ...
|
#
2410fb46 |
| 21-Oct-2021 |
Duncan P. N. Exon Smith <dexonsmith@apple.com> |
Support: Use Expected<T>::moveInto() in a few places
These are some usage examples for `Expected<T>::moveInto()`.
Differential Revision: https://reviews.llvm.org/D112280
|
#
08ed2160 |
| 20-Oct-2021 |
Itay Bookstein <ibookstein@gmail.com> |
[IR] Refactor GlobalIFunc to inherit from GlobalObject, Remove GlobalIndirectSymbol
As discussed in: * https://reviews.llvm.org/D94166 * https://lists.llvm.org/pipermail/llvm-dev/2020-September/1450
[IR] Refactor GlobalIFunc to inherit from GlobalObject, Remove GlobalIndirectSymbol
As discussed in: * https://reviews.llvm.org/D94166 * https://lists.llvm.org/pipermail/llvm-dev/2020-September/145031.html
The GlobalIndirectSymbol class lost most of its meaning in https://reviews.llvm.org/D109792, which disambiguated getBaseObject (now getAliaseeObject) between GlobalIFunc and everything else. In addition, as long as GlobalIFunc is not a GlobalObject and getAliaseeObject returns GlobalObjects, a GlobalAlias whose aliasee is a GlobalIFunc cannot currently be modeled properly. Creating aliases for GlobalIFuncs does happen in the wild (e.g. glibc). In addition, calling getAliaseeObject on a GlobalIFunc will currently return nullptr, which is undesirable because it should return the object itself for non-aliases.
This patch refactors the GlobalIFunc class to inherit directly from GlobalObject, and removes GlobalIndirectSymbol (while inlining the relevant parts into GlobalAlias and GlobalIFunc). This allows for calling getAliaseeObject() on a GlobalIFunc to return the GlobalIFunc itself, making getAliaseeObject() more consistent and enabling alias-to-ifunc to be properly modeled in the IR.
I exercised some judgement in the API clients of GlobalIndirectSymbol: some were 'monomorphized' for GlobalAlias and GlobalIFunc, and some remained shared (with the type adapted to become GlobalValue).
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D108872
show more ...
|
#
778bf73d |
| 09-Oct-2021 |
william woodruff <william@yossarian.net> |
[BitcodeReader] fix a logic error in vector type element validation
The current code checks whether the vector's element type is a valid structure element type, rather than a valid vector element ty
[BitcodeReader] fix a logic error in vector type element validation
The current code checks whether the vector's element type is a valid structure element type, rather than a valid vector element type. The two have separate implementations and but only accept very slightly different sets of types, which is probably why this wasn't caught before.
Differential Revision: https://reviews.llvm.org/D109655
show more ...
|
#
05392466 |
| 24-Sep-2021 |
Arthur Eubanks <aeubanks@google.com> |
Reland [IR] Increase max alignment to 4GB
Currently the max alignment representable is 1GB, see D108661. Setting the align of an object to 4GB is desirable in some cases to make sure the lower 32 bi
Reland [IR] Increase max alignment to 4GB
Currently the max alignment representable is 1GB, see D108661. Setting the align of an object to 4GB is desirable in some cases to make sure the lower 32 bits are clear which can be used for some optimizations, e.g. https://crbug.com/1016945.
This uses an extra bit in instructions that carry an alignment. We can store 15 bits of "free" information, and with this change some instructions (e.g. AtomicCmpXchgInst) use 14 bits. We can increase the max alignment representable above 4GB (up to 2^62) since we're only using 33 of the 64 values, but I've just limited it to 4GB for now.
The one place we have to update the bitcode format is for the alloca instruction. It stores its alignment into 5 bits of a 32 bit bitfield. I've added another field which is 8 bits and should be future proof for a while. For backward compatibility, we check if the old field has a value and use that, otherwise use the new field.
Updating clang's max allowed alignment will come in a future patch.
Reviewed By: hans
Differential Revision: https://reviews.llvm.org/D110451
show more ...
|
#
569346f2 |
| 06-Oct-2021 |
Arthur Eubanks <aeubanks@google.com> |
Revert "Reland [IR] Increase max alignment to 4GB"
This reverts commit 8d64314ffea55f2ad94c1b489586daa8ce30f451.
|
#
8d64314f |
| 24-Sep-2021 |
Arthur Eubanks <aeubanks@google.com> |
Reland [IR] Increase max alignment to 4GB
Currently the max alignment representable is 1GB, see D108661. Setting the align of an object to 4GB is desirable in some cases to make sure the lower 32 bi
Reland [IR] Increase max alignment to 4GB
Currently the max alignment representable is 1GB, see D108661. Setting the align of an object to 4GB is desirable in some cases to make sure the lower 32 bits are clear which can be used for some optimizations, e.g. https://crbug.com/1016945.
This uses an extra bit in instructions that carry an alignment. We can store 15 bits of "free" information, and with this change some instructions (e.g. AtomicCmpXchgInst) use 14 bits. We can increase the max alignment representable above 4GB (up to 2^62) since we're only using 33 of the 64 values, but I've just limited it to 4GB for now.
The one place we have to update the bitcode format is for the alloca instruction. It stores its alignment into 5 bits of a 32 bit bitfield. I've added another field which is 8 bits and should be future proof for a while. For backward compatibility, we check if the old field has a value and use that, otherwise use the new field.
Updating clang's max allowed alignment will come in a future patch.
Reviewed By: hans
Differential Revision: https://reviews.llvm.org/D110451
show more ...
|
#
72cf8b60 |
| 06-Oct-2021 |
Arthur Eubanks <aeubanks@google.com> |
Revert "[IR] Increase max alignment to 4GB"
This reverts commit df84c1fe78130a86445d57563dea742e1b85156a.
Breaks some bots
|
#
df84c1fe |
| 24-Sep-2021 |
Arthur Eubanks <aeubanks@google.com> |
[IR] Increase max alignment to 4GB
Currently the max alignment representable is 1GB, see D108661. Setting the align of an object to 4GB is desirable in some cases to make sure the lower 32 bits are
[IR] Increase max alignment to 4GB
Currently the max alignment representable is 1GB, see D108661. Setting the align of an object to 4GB is desirable in some cases to make sure the lower 32 bits are clear which can be used for some optimizations, e.g. https://crbug.com/1016945.
This uses an extra bit in instructions that carry an alignment. We can store 15 bits of "free" information, and with this change some instructions (e.g. AtomicCmpXchgInst) use 14 bits. We can increase the max alignment representable above 4GB (up to 2^62) since we're only using 33 of the 64 values, but I've just limited it to 4GB for now.
The one place we have to update the bitcode format is for the alloca instruction. It stores its alignment into 5 bits of a 32 bit bitfield. I've added another field which is 8 bits and should be future proof for a while. For backward compatibility, we check if the old field has a value and use that, otherwise use the new field.
Updating clang's max allowed alignment will come in a future patch.
Reviewed By: hans
Differential Revision: https://reviews.llvm.org/D110451
show more ...
|
#
20faf789 |
| 27-Sep-2021 |
modimo <modimo@fb.com> |
[ThinLTO] Add noRecurse and noUnwind thinlink function attribute propagation
Thinlink provides an opportunity to propagate function attributes across modules, enabling additional propagation opportu
[ThinLTO] Add noRecurse and noUnwind thinlink function attribute propagation
Thinlink provides an opportunity to propagate function attributes across modules, enabling additional propagation opportunities.
This change propagates (currently default off, turn on with `disable-thinlto-funcattrs=1`) noRecurse and noUnwind based off of function summaries of the prevailing functions in bottom-up call-graph order. Testing on clang self-build: 1. There's a 35-40% increase in noUnwind functions due to the additional propagation opportunities. 2. Throughput is measured at 10-15% increase in thinlink time which itself is 1.5% of E2E link time.
Implementation-wise this adds the following summary function attributes: 1. noUnwind: function is noUnwind 2. mayThrow: function contains a non-call instruction that `Instruction::mayThrow` returns true on (e.g. windows SEH instructions) 3. hasUnknownCall: function contains calls that don't make it into the summary call-graph thus should not be propagated from (e.g. indirect for now, could add no-opt functions as well)
Testing: Clang self-build passes and 2nd stage build passes check-all ninja check-all with newly added tests passing
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D36850
show more ...
|
#
749ddd25 |
| 11-Sep-2021 |
guopeilin <guopeilin1@huawei.com> |
[BitcodeReader] Delay select until all constants resolved
Like the shuffle, we should treat the select delayed so that all constants can be resolved.
Reviewed By: efriedma
Differential Revision: h
[BitcodeReader] Delay select until all constants resolved
Like the shuffle, we should treat the select delayed so that all constants can be resolved.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D109053
show more ...
|
#
90ec6dff |
| 04-Sep-2021 |
Nikita Popov <nikita.ppv@gmail.com> |
[OpaquePtr] Forbid mixing typed and opaque pointers
Currently, opaque pointers are supported in two forms: The -force-opaque-pointers mode, where all pointers are opaque and typed pointers do not ex
[OpaquePtr] Forbid mixing typed and opaque pointers
Currently, opaque pointers are supported in two forms: The -force-opaque-pointers mode, where all pointers are opaque and typed pointers do not exist. And as a simple ptr type that can coexist with typed pointers.
This patch removes support for the mixed mode. You either get typed pointers, or you get opaque pointers, but not both. In the (current) default mode, using ptr is forbidden. In -opaque-pointers mode, all pointers are opaque.
The motivation here is that the mixed mode introduces additional issues that don't exist in fully opaque mode. D105155 is an example of a design problem. Looking at D109259, it would probably need additional work to support mixed mode (e.g. to generate GEPs for typed base but opaque result). Mixed mode will also end up inserting many casts between i8* and ptr, which would require significant additional work to consistently avoid.
I don't think the mixed mode is particularly valuable, as it doesn't align with our end goal. The only thing I've found it to be moderately useful for is adding some opaque pointer tests in between typed pointer tests, but I think we can live without that.
Differential Revision: https://reviews.llvm.org/D109290
show more ...
|
#
f5832eaa |
| 04-Sep-2021 |
Nikita Popov <nikita.ppv@gmail.com> |
[UseListOrder] Fix use list order for function operands
Functions can have a personality function, as well as prefix and prologue data as additional operands. Unused operands are assigned a dummy va
[UseListOrder] Fix use list order for function operands
Functions can have a personality function, as well as prefix and prologue data as additional operands. Unused operands are assigned a dummy value of i1* null. This patch addresses multiple issues in use-list order preservation for these:
* Fix verify-uselistorder to also enumerate the dummy values. This means that now use-list order values of these values are shuffled even if there is no other mention of i1* null in the module. This results in failures of Assembler/call-arg-is-callee.ll, Assembler/opaque-ptr.ll and Bitcode/use-list-order2.ll. * The use-list order prediction in ValueEnumerator does not take into account the fact that a global may use a value more than once and leaves uses in the same global effectively unordered. We should be comparing the operand number here, as we do for the more general case. * While we enumerate all operands of a function together (which seems sensible to me), the bitcode reader would first resolve prefix data for all function, then prologue data for all functions, then personality functions for all functions. Change this to resolve all operands for a given function together instead.
Differential Revision: https://reviews.llvm.org/D109282
show more ...
|
#
b0391dfc |
| 13-Aug-2021 |
Alexander Potapenko <glider@google.com> |
[clang][Codegen] Introduce the disable_sanitizer_instrumentation attribute
The purpose of __attribute__((disable_sanitizer_instrumentation)) is to prevent all kinds of sanitizer instrumentation appl
[clang][Codegen] Introduce the disable_sanitizer_instrumentation attribute
The purpose of __attribute__((disable_sanitizer_instrumentation)) is to prevent all kinds of sanitizer instrumentation applied to a certain function, Objective-C method, or global variable.
The no_sanitize(...) attribute drops instrumentation checks, but may still insert code preventing false positive reports. In some cases though (e.g. when building Linux kernel with -fsanitize=kernel-memory or -fsanitize=thread) the users may want to avoid any kind of instrumentation.
Differential Revision: https://reviews.llvm.org/D108029
show more ...
|
#
3f4d00bc |
| 18-Aug-2021 |
Arthur Eubanks <aeubanks@google.com> |
[NFC] More get/removeAttribute() cleanup
|
#
80ea2bb5 |
| 13-Aug-2021 |
Arthur Eubanks <aeubanks@google.com> |
[NFC] Rename AttributeList::getParam/Ret/FnAttributes() -> get*Attributes()
This is more consistent with similar methods.
|
Revision tags: llvmorg-13.0.0-rc1, llvmorg-14-init |
|
#
39248779 |
| 20-Jul-2021 |
Fangrui Song <i@maskray.me> |
[IR] Rename `comdat noduplicates` to `comdat nodeduplicate`
In the textual format, `noduplicates` means no COMDAT/section group deduplication is performed. Therefore, if both sets of sections are re
[IR] Rename `comdat noduplicates` to `comdat nodeduplicate`
In the textual format, `noduplicates` means no COMDAT/section group deduplication is performed. Therefore, if both sets of sections are retained, and they happen to define strong external symbols with the same names, there will be a duplicate definition linker error.
In PE/COFF, the selection kind lowers to `IMAGE_COMDAT_SELECT_NODUPLICATES`. The name describes the corollary instead of the immediate semantics. The name can cause confusion to other binary formats (ELF, wasm) which have implemented/ want to implement the "no deduplication" selection kind. Rename it to be clearer.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D106319
show more ...
|
#
6312a75d |
| 20-Jul-2021 |
Nikita Popov <nikita.ppv@gmail.com> |
[BitcodeReader] Handle type attributes more explicitly (NFCI)
For attributes in legacy bitcode that are now typed, explicitly create a type attribute with nullptr type, the same as we do for the att
[BitcodeReader] Handle type attributes more explicitly (NFCI)
For attributes in legacy bitcode that are now typed, explicitly create a type attribute with nullptr type, the same as we do for the attribute group representation. This is so we can assert use of the correct constructor in the future.
show more ...
|
#
be5af50e |
| 16-Jul-2021 |
Nikita Popov <nikita.ppv@gmail.com> |
[BPF] Use elementtype attribute for preserve.array/struct.index intrinsics
Use the elementtype attribute introduced in D105407 for the llvm.preserve.array/struct.index intrinsics. It carries the ele
[BPF] Use elementtype attribute for preserve.array/struct.index intrinsics
Use the elementtype attribute introduced in D105407 for the llvm.preserve.array/struct.index intrinsics. It carries the element type of the GEP these intrinsics effectively encode.
This patch:
* Adds a verifier check that the attribute is required. * Adds it in the IRBuilder methods for these intrinsics. * Autoupgrades old bitcode without the attribute. * Updates the lowering code to use the attribute rather than the pointer element type. * Updates lots of tests to specify the attribute. * Adds -force-opaque-pointers to the intrinsic-array.ll test to demonstrate they work now.
https://reviews.llvm.org/D106184
show more ...
|
#
c191035f |
| 07-Jul-2021 |
Nikita Popov <nikita.ppv@gmail.com> |
[IR] Add elementtype attribute
This implements the elementtype attribute specified in D105407. It just adds the attribute and the specified verifier rules, but doesn't yet make use of it anywhere.
[IR] Add elementtype attribute
This implements the elementtype attribute specified in D105407. It just adds the attribute and the specified verifier rules, but doesn't yet make use of it anywhere.
Differential Revision: https://reviews.llvm.org/D106008
show more ...
|
#
3fb0621f |
| 12-Jul-2021 |
Nikita Popov <nikita.ppv@gmail.com> |
[Attributes] Assert correct attribute constructor is used (NFCI)
Assert that enum/int/type attributes go through the constructor they are supposed to use.
To make sure this can't happen via invalid
[Attributes] Assert correct attribute constructor is used (NFCI)
Assert that enum/int/type attributes go through the constructor they are supposed to use.
To make sure this can't happen via invalid bitcode, explicitly verify that the attribute kind if correct there.
show more ...
|
#
5d1464cb |
| 10-Jul-2021 |
Nikita Popov <nikita.ppv@gmail.com> |
[Attributes] Make type attribute handling more generic (NFCI)
Followup to D105658 to make AttrBuilder automatically work with new type attributes. TableGen is tweaked to emit First/LastTypeAttr mark
[Attributes] Make type attribute handling more generic (NFCI)
Followup to D105658 to make AttrBuilder automatically work with new type attributes. TableGen is tweaked to emit First/LastTypeAttr markers, based on which we can handle type attributes programmatically.
Differential Revision: https://reviews.llvm.org/D105763
show more ...
|
#
cb3580e7 |
| 29-Jun-2021 |
Arthur Eubanks <aeubanks@google.com> |
[OpaquePtr][BitcodeWriter] Handle attributes with types
For example, byval.
Skip the type attribute auto-upgrade if we already have the type.
I've actually seen this error of the ValueEnumerator m
[OpaquePtr][BitcodeWriter] Handle attributes with types
For example, byval.
Skip the type attribute auto-upgrade if we already have the type.
I've actually seen this error of the ValueEnumerator missing a type attribute's type in a non-opaque pointer context.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D105138
show more ...
|
Revision tags: llvmorg-12.0.1, llvmorg-12.0.1-rc4 |
|
#
4ae0ab09 |
| 27-Jun-2021 |
Nathan Chancellor <nathan@kernel.org> |
[BitCode] Add noprofile to getAttrFromCode()
After D104475 / D104658, building the Linux kernel with ThinLTO is broken:
ld.lld: error: Unknown attribute kind (73) (Producer: 'LLVM13.0.0git' Reader:
[BitCode] Add noprofile to getAttrFromCode()
After D104475 / D104658, building the Linux kernel with ThinLTO is broken:
ld.lld: error: Unknown attribute kind (73) (Producer: 'LLVM13.0.0git' Reader: 'LLVM 13.0.0git')
getAttrFromCode() has never handled this attribute so it is written during the ThinLTO phase but it cannot be handled during the linking phase.
Add noprofile to getAttrFromCode() so that disassembly works properly.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D104995
show more ...
|
Revision tags: llvmorg-12.0.1-rc3 |
|
#
e5f2b035 |
| 22-Jun-2021 |
Nikita Popov <nikita.ppv@gmail.com> |
[OpaquePtr] Support invoke instruction
With call support in place, this is only a matter of relaxing a bitcode reader assertion.
|