#
3b1fd193 |
| 30-Oct-2021 |
Itay Bookstein <ibookstein@gmail.com> |
[CodeGen] Diagnose and reject non-function ifunc resolvers
Signed-off-by: Itay Bookstein <ibookstein@gmail.com>
Reviewed By: MaskRay, erichkeane
Differential Revision: https://reviews.llvm.org/D11
[CodeGen] Diagnose and reject non-function ifunc resolvers
Signed-off-by: Itay Bookstein <ibookstein@gmail.com>
Reviewed By: MaskRay, erichkeane
Differential Revision: https://reviews.llvm.org/D112868
show more ...
|
#
737c4a26 |
| 09-Nov-2021 |
Atmn Patel <atmndp@gmail.com> |
[clang][openmp][NFC] Remove arch-specific CGOpenMPRuntimeGPU files
The existing CGOpenMPRuntimeAMDGCN and CGOpenMPRuntimeNVPTX classes are just code bloat. By removing them, the codebase gets a bit
[clang][openmp][NFC] Remove arch-specific CGOpenMPRuntimeGPU files
The existing CGOpenMPRuntimeAMDGCN and CGOpenMPRuntimeNVPTX classes are just code bloat. By removing them, the codebase gets a bit cleaner.
Reviewed By: jdoerfert, JonChesterfield, tianshilei1992
Differential Revision: https://reviews.llvm.org/D113421
show more ...
|
#
ef717f38 |
| 09-Nov-2021 |
Atmn Patel <atmndp@gmail.com> |
Revert "[clang][openmp][NFC] Remove arch-specific CGOpenMPRuntimeGPU files"
This reverts commit 81a7cad2ffc18f15b732f69d991c8398c979c5ca.
|
#
81a7cad2 |
| 09-Nov-2021 |
Atmn Patel <atmndp@gmail.com> |
[clang][openmp][NFC] Remove arch-specific CGOpenMPRuntimeGPU files
The existing CGOpenMPRuntimeAMDGCN and CGOpenMPRuntimeNVPTX classes are just code bloat. By removing them, the codebase gets a bit
[clang][openmp][NFC] Remove arch-specific CGOpenMPRuntimeGPU files
The existing CGOpenMPRuntimeAMDGCN and CGOpenMPRuntimeNVPTX classes are just code bloat. By removing them, the codebase gets a bit cleaner.
Reviewed By: jdoerfert, JonChesterfield, tianshilei1992
Differential Revision: https://reviews.llvm.org/D113421
show more ...
|
#
8adb6d6d |
| 07-Nov-2021 |
Benjamin Kramer <benny.kra@googlemail.com> |
[clang] Use llvm::reverse. NFCI.
|
#
848812a5 |
| 01-Nov-2021 |
Itay Bookstein <ibookstein@gmail.com> |
[Verifier] Add verification logic for GlobalIFuncs
Verify that the resolver exists, that it is a defined Function, and that its return type matches the ifunc's type. Add corresponding check to Bitco
[Verifier] Add verification logic for GlobalIFuncs
Verify that the resolver exists, that it is a defined Function, and that its return type matches the ifunc's type. Add corresponding check to BitcodeReader, change clang to emit the correct type, and fix tests to comply.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D112349
show more ...
|
#
aad244df |
| 21-Oct-2021 |
Aaron Ballman <aaron@aaronballman.com> |
Revert "AddGlobalAnnotations for function with or without function body."
This reverts commit 121b2252de0eed68f2ddf5f09e924a6c35423d47.
The following code causes a crash in some circumstances:
s
Revert "AddGlobalAnnotations for function with or without function body."
This reverts commit 121b2252de0eed68f2ddf5f09e924a6c35423d47.
The following code causes a crash in some circumstances:
struct k { ~k() __attribute__((annotate(""))) {} }; void m() { k(); }
show more ...
|
#
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 ...
|
#
d245f2e8 |
| 17-Oct-2021 |
Kazu Hirata <kazu@google.com> |
[clang] Use llvm::erase_if (NFC)
|
#
121b2252 |
| 11-Oct-2021 |
Chris Bieneman <chris.bieneman@me.com> |
AddGlobalAnnotations for function with or without function body.
When AnnotateAttr is on a function, AddGlobalAnnotations is only called in CodeGenModule::EmitGlobalFunctionDefinition which means An
AddGlobalAnnotations for function with or without function body.
When AnnotateAttr is on a function, AddGlobalAnnotations is only called in CodeGenModule::EmitGlobalFunctionDefinition which means AnnotateAttr on function declaration without function body will be ignored. The patch will move AddGlobalAnnotations to CodeGenModule::SetFunctionAttributes, so with or without function body, the AnnotateAttr will get code gen for a function.
It'll help case when AnnotateAttr is on external function, and the AnnotateAttr will be consumed in IR level.
For example, a pass to collect num of uses for functions with __attribute((annotate("count_use"))) after optimizations, As long as there's __attribute((annotate("count_use"))), function with or without function body should be counted.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D111109
Patch by: python3kgae (Xiang Li)
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 ...
|
#
aa53785f |
| 23-Sep-2021 |
Arthur Eubanks <aeubanks@google.com> |
Reland [clang] Rework dontcall attributes
To avoid using the AST when emitting diagnostics, split the "dontcall" attribute into "dontcall-warn" and "dontcall-error", and also add the frontend attrib
Reland [clang] Rework dontcall attributes
To avoid using the AST when emitting diagnostics, split the "dontcall" attribute into "dontcall-warn" and "dontcall-error", and also add the frontend attribute value as the LLVM attribute value. This gives us all the information to report diagnostics we need from within the IR (aside from access to the original source).
One downside is we directly use LLVM's demangler rather than using the existing Clang diagnostic pretty printing of symbols.
Previous revisions didn't properly declare the new dependencies.
Reviewed By: nickdesaulniers
Differential Revision: https://reviews.llvm.org/D110364
show more ...
|
#
7833d20f |
| 28-Sep-2021 |
Arthur Eubanks <aeubanks@google.com> |
Revert "[clang] Rework dontcall attributes"
This reverts commit 2943071e2ee0c7f31f34062a44d12aeb0e3a66fd.
Breaks bots
|
#
2943071e |
| 23-Sep-2021 |
Arthur Eubanks <aeubanks@google.com> |
[clang] Rework dontcall attributes
To avoid using the AST when emitting diagnostics, split the "dontcall" attribute into "dontcall-warn" and "dontcall-error", and also add the frontend attribute val
[clang] Rework dontcall attributes
To avoid using the AST when emitting diagnostics, split the "dontcall" attribute into "dontcall-warn" and "dontcall-error", and also add the frontend attribute value as the LLVM attribute value. This gives us all the information to report diagnostics we need from within the IR (aside from access to the original source).
One downside is we directly use LLVM's demangler rather than using the existing Clang diagnostic pretty printing of symbols.
Reviewed By: nickdesaulniers
Differential Revision: https://reviews.llvm.org/D110364
show more ...
|
#
c3717b68 |
| 16-Sep-2021 |
serge-sans-paille <sguelton@redhat.com> |
Simplify handling of builtin with inline redefinition
(This is a recommit of 3d6f49a56995b845 that should no longer break validation since bd379915de38a9af3d65e1).
It is a common practice in glibc
Simplify handling of builtin with inline redefinition
(This is a recommit of 3d6f49a56995b845 that should no longer break validation since bd379915de38a9af3d65e1).
It is a common practice in glibc header to provide an inline redefinition of an existing function. It is especially the case for fortified function.
Clang currently has an imperfect approach to the problem, using a combination of trivially recursive function detection and noinline attribute.
Simplify the logic by suffixing these functions by `.inline` during codegen, so that they are not recognized as builtin by llvm.
After that patch, clang passes all tests from https://github.com/serge-sans-paille/fortify-test-suite
Differential Revision: https://reviews.llvm.org/D109967
show more ...
|
#
0d76d483 |
| 28-Sep-2021 |
Kevin Athey <kda@google.com> |
Revert "Simplify handling of builtin with inline redefinition"
This reverts commit 3d6f49a56995b845c40be5827ded5d1e3f692cec.
Broke bot: https://lab.llvm.org/buildbot/#/builders/5/builds/12360
|
#
3d6f49a5 |
| 16-Sep-2021 |
serge-sans-paille <sguelton@redhat.com> |
Simplify handling of builtin with inline redefinition
It is a common practice in glibc header to provide an inline redefinition of an existing function. It is especially the case for fortified funct
Simplify handling of builtin with inline redefinition
It is a common practice in glibc header to provide an inline redefinition of an existing function. It is especially the case for fortified function.
Clang currently has an imperfect approach to the problem, using a combination of trivially recursive function detection and noinline attribute.
Simplify the logic by suffixing these functions by `.inline` during codegen, so that they are not recognized as builtin by llvm.
After that patch, clang passes all tests from https://github.com/serge-sans-paille/fortify-test-suite
Differential Revision: https://reviews.llvm.org/D109967
show more ...
|
#
e3b10525 |
| 16-Sep-2021 |
Erich Keane <erich.keane@intel.com> |
Make multiversioning work with internal linkage
We previously made all multiversioning resolvers/ifuncs have weak ODR linkage in IR, since we NEED to emit the whole resolver every time we see a call
Make multiversioning work with internal linkage
We previously made all multiversioning resolvers/ifuncs have weak ODR linkage in IR, since we NEED to emit the whole resolver every time we see a call, but it is not necessarily the place where all the definitions live.
HOWEVER, when doing so, we neglected the case where the versions have internal linkage. This patch ensures we do this, so you don't get weird behavior with static functions.
show more ...
|
#
f9bc1b3b |
| 24-Aug-2021 |
Justas Janickas <Justas.Janickas@arm.com> |
[OpenCL] Defines helper function for kernel language compatible OpenCL version
This change defines a helper function getOpenCLCompatibleVersion() inside LangOptions class. The function contains mapp
[OpenCL] Defines helper function for kernel language compatible OpenCL version
This change defines a helper function getOpenCLCompatibleVersion() inside LangOptions class. The function contains mapping between C++ for OpenCL versions and their corresponding compatible OpenCL versions. This mapping function should be updated each time a new C++ for OpenCL language version is introduced. The helper function is expected to simplify conditions on OpenCL C and C++ for OpenCL versions inside compiler code.
Code refactoring performed.
Differential Revision: https://reviews.llvm.org/D108693
show more ...
|
#
1724a164 |
| 30-Aug-2021 |
Andrei Elovikov <andrei.elovikov@intel.com> |
[NFC][clang] Move IR-independent parts of target MV support to X86TargetParser.cpp
...that is located under llvm/lib/Support/.
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.o
[NFC][clang] Move IR-independent parts of target MV support to X86TargetParser.cpp
...that is located under llvm/lib/Support/.
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D108423
show more ...
|
#
7cab90a7 |
| 26-Aug-2021 |
Alex Richardson <Alexander.Richardson@cl.cam.ac.uk> |
Fix __attribute__((annotate("")) with non-zero globals AS
The existing code attempting to bitcast from a value in the default globals AS to i8 addrspace(0)* was triggering an assertion failure in ou
Fix __attribute__((annotate("")) with non-zero globals AS
The existing code attempting to bitcast from a value in the default globals AS to i8 addrspace(0)* was triggering an assertion failure in our downstream fork. I found this while compiling poppler for CHERI-RISC-V (we use AS200 for all globals). The test case uses AMDGPU since that is one of the in-tree targets with a non-zero default globals address space. The new test previously triggered a "Invalid constantexpr bitcast!" assertion and now correctly generates code with addrspace(1) pointers.
Reviewed By: rjmccall
Differential Revision: https://reviews.llvm.org/D105972
show more ...
|