Revision tags: llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init |
|
#
3391bdc2 |
| 13-Jun-2023 |
Noah Goldstein <goldstein.w.n@gmail.com> |
Revert "[FunctionAttrs] Propagate some func/arg/ret attributes from caller to callsite (WIP)"
Accidental commit/push!
This reverts commit 4fa971ff62c3c48c606b792c572c03bd4d5906ee.
|
#
4fa971ff |
| 13-Jun-2023 |
Noah Goldstein <goldstein.w.n@gmail.com> |
[FunctionAttrs] Propagate some func/arg/ret attributes from caller to callsite (WIP)
This is the consolidation of D151644 and D151943 moved from InstCombine to FunctionAttrs. This is based on discus
[FunctionAttrs] Propagate some func/arg/ret attributes from caller to callsite (WIP)
This is the consolidation of D151644 and D151943 moved from InstCombine to FunctionAttrs. This is based on discussion in the above patches as well as D152081 (Attributor). This patch was written in a way so it can have an immediate impact in currently active passes (FunctionAttrs), but should be easy to port elsewhere (Attributor or Inliner) if that makes more sense later on.
Some function attributes imply the attribute for all/some instructions in the function. These attributes can be safely propagated to callsites within the function that are missing the attribute. This can be useful when 1) analyzing individual instructions in a function and 2) if the original caller is later inlined, as if the attributes are not propagated, they will be lost.
This patch implements propagation in a new class/file `InferCallsiteAttrs` which can hypothetically be included elsewhere.
At the moment this patch infers the following:
Function Attributes: - mustprogress - nofree - willreturn - All memory attributes (readnone, readonly, writeonly, argmem, etc...) - The memory attributes are only propagated IFF the set of pointers available to the callsite is the same as the set available outside the caller (i.e no local memory arguments from alloca or local malloc like functions).
Argument Attributes: - noundef - nonnull - nofree - readnone - readonly - writeonly - nocapture - nocapture is only propagated IFF the set of pointers available to the callsite is the same as the set available outside the caller and its guranteed that between the callsite and function return, the state of any capture pointers will not change (so the nocaptured gurantee of the caller has been met by the instruction preceding the callsite and will not changed).
Argument are only propagated to callsite arguments that are also function arguments, but not derived values.
Return Attributes: - noundef - nonnull
Return attributes are only propagated if the callsite's return value is used as the caller's return and execution is guranteed to pass from callsite to return.
The compile time hit of this for -O3 and -O3+thinLTO is ~[.02, .37]% regression. Proper LTO, however, has more significant regressions (up to 3.92%): https://llvm-compile-time-tracker.com/compare.php?from=94407e1bba9807193afde61c56b6125c0fc0b1d1&to=79feb6e78b818e33ec69abdc58c5f713d691554f&stat=instructions:u
Differential Revision: https://reviews.llvm.org/D152226
show more ...
|
Revision tags: llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4 |
|
#
cd0174aa |
| 31-Oct-2022 |
Weining Lu <luweining@loongson.cn> |
[Clang][LoongArch] Support inline asm constraint 'J'
'J' is defined in GCC [1] but not documented [2] while Linux [3] has already used it in LoongArch port.
[1]: https://github.com/gcc-mirror/gcc/b
[Clang][LoongArch] Support inline asm constraint 'J'
'J' is defined in GCC [1] but not documented [2] while Linux [3] has already used it in LoongArch port.
[1]: https://github.com/gcc-mirror/gcc/blob/master/gcc/config/loongarch/constraints.md#L61 [2]: https://gcc.gnu.org/onlinedocs/gccint/Machine-Constraints.html [3]: https://github.com/torvalds/linux/blob/master/arch/loongarch/include/asm/cmpxchg.h#L19
Differential Revision: https://reviews.llvm.org/D136835
show more ...
|
Revision tags: llvmorg-15.0.3 |
|
#
42b70793 |
| 11-Oct-2022 |
Weining Lu <luweining@loongson.cn> |
Reland "[Clang][LoongArch] Add inline asm support for constraints k/m/ZB/ZC"
Reference: https://gcc.gnu.org/onlinedocs/gccint/Machine-Constraints.html
k: A memory operand whose address is formed by
Reland "[Clang][LoongArch] Add inline asm support for constraints k/m/ZB/ZC"
Reference: https://gcc.gnu.org/onlinedocs/gccint/Machine-Constraints.html
k: A memory operand whose address is formed by a base register and (optionally scaled) index register.
m: A memory operand whose address is formed by a base register and offset that is suitable for use in instructions with the same addressing mode as st.w and ld.w.
ZB: An address that is held in a general-purpose register. The offset is zero.
ZC: A memory operand whose address is formed by a base register and offset that is suitable for use in instructions with the same addressing mode as ll.w and sc.w.
Note: The INLINEASM SDNode flags in below tests are updated because the new introduced enum `Constraint_k` is added before `Constraint_m`. llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-inline-asm.ll llvm/test/CodeGen/AMDGPU/GlobalISel/irtranslator-inline-asm.ll llvm/test/CodeGen/X86/callbr-asm-kill.mir
This patch passes `ninja check-all` on a X86 machine with all official targets and the LoongArch target enabled.
Differential Revision: https://reviews.llvm.org/D134638
show more ...
|
Revision tags: working, llvmorg-15.0.2 |
|
#
04a65d62 |
| 29-Sep-2022 |
Fangrui Song <i@maskray.me> |
Revert D134638 "[Clang][LoongArch] Add inline asm support for constraints k/m/ZB/ZC"
This reverts commit b7baddc7557e5c35a0f6a604a134d849265a99d4.
Broke CodeGen/X86/callbr-asm-kill.mir We shall pay
Revert D134638 "[Clang][LoongArch] Add inline asm support for constraints k/m/ZB/ZC"
This reverts commit b7baddc7557e5c35a0f6a604a134d849265a99d4.
Broke CodeGen/X86/callbr-asm-kill.mir We shall pay attention when adding new constraints.
show more ...
|
#
b7baddc7 |
| 29-Sep-2022 |
Weining Lu <luweining@loongson.cn> |
[Clang][LoongArch] Add inline asm support for constraints k/m/ZB/ZC
k: A memory operand whose address is formed by a base register and (optionally scaled) index register.
m: A memory operand whose
[Clang][LoongArch] Add inline asm support for constraints k/m/ZB/ZC
k: A memory operand whose address is formed by a base register and (optionally scaled) index register.
m: A memory operand whose address is formed by a base register and offset that is suitable for use in instructions with the same addressing mode as st.w and ld.w.
ZB: An address that is held in a general-purpose register. The offset is zero.
ZC: A memory operand whose address is formed by a base register and offset that is suitable for use in instructions with the same addressing mode as ll.w and sc.w.
Differential Revision: https://reviews.llvm.org/D134638
show more ...
|
#
394f3091 |
| 22-Sep-2022 |
Weining Lu <luweining@loongson.cn> |
[Clang][LoongArch] Add inline asm support for constraints f/l/I/K
This patch adds support for constraints `f`, `l`, `I`, `K` according to [1]. The remain constraints (`k`, `m`, `ZB`, `ZC`) will be a
[Clang][LoongArch] Add inline asm support for constraints f/l/I/K
This patch adds support for constraints `f`, `l`, `I`, `K` according to [1]. The remain constraints (`k`, `m`, `ZB`, `ZC`) will be added later as they are a little more complex than the others. f: A floating-point register (if available). l: A signed 16-bit constant. I: A signed 12-bit constant (for arithmetic instructions). K: An unsigned 12-bit constant (for logic instructions).
For now, no need to support register alias (e.g. `$a0`) in llvm as clang will correctly decode the usage of register name aliases into their official names. And AFAIK, the not yet upstreamed `rustc` for LoongArch will always use official register names (e.g. `$r4`).
[1] https://gcc.gnu.org/onlinedocs/gccint/Machine-Constraints.html
Differential Revision: https://reviews.llvm.org/D134157
show more ...
|