[clang] [llvm] [Clang][BPF] Allow sign extension for int type call parameters (PR #84874)

2024-03-12 Thread via cfe-commits
https://github.com/yonghong-song updated https://github.com/llvm/llvm-project/pull/84874 >From e2a62512b1693d06dc3421d93de17fc248a6a496 Mon Sep 17 00:00:00 2001 From: Yonghong Song Date: Mon, 11 Mar 2024 22:27:37 -0700 Subject: [PATCH] [Clang][BPF] Allow sign/zero extension for call parameters

[clang] [llvm] [Clang][BPF] Allow sign extension for int type call parameters (PR #84874)

2024-03-12 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: The way LLVM backend works in general is that if an integer is smaller than a register, when type legalization converts that to a larger integer, the high bits are undefined. This generally doesn't cause any issues because nothing can actually observe those bits. Your

[clang] [llvm] [Clang][BPF] Allow sign extension for int type call parameters (PR #84874)

2024-03-12 Thread via cfe-commits
@@ -22,6 +22,19 @@ class BPFABIInfo : public DefaultABIInfo { public: BPFABIInfo(CodeGenTypes ) : DefaultABIInfo(CGT) {} + bool isPromotableIntegerTypeForABI(QualType Ty) const { +if (ABIInfo::isPromotableIntegerTypeForABI(Ty) == true) + return true; + +if

[clang] [llvm] [Clang][BPF] Allow sign extension for int type call parameters (PR #84874)

2024-03-12 Thread via cfe-commits
@@ -22,6 +22,19 @@ class BPFABIInfo : public DefaultABIInfo { public: BPFABIInfo(CodeGenTypes ) : DefaultABIInfo(CGT) {} + bool isPromotableIntegerTypeForABI(QualType Ty) const { +if (ABIInfo::isPromotableIntegerTypeForABI(Ty) == true) + return true; + +if

[clang] [llvm] [Clang][BPF] Allow sign extension for int type call parameters (PR #84874)

2024-03-12 Thread Pu Lehui via cfe-commits
pulehui wrote: Thanks Yonghong. It works through the kfunc_call case in no_alu32 mode, as well as other cases in riscv64. Tested-by: Pu Lehui https://github.com/llvm/llvm-project/pull/84874 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [llvm] [Clang][BPF] Allow sign extension for int type call parameters (PR #84874)

2024-03-11 Thread via cfe-commits
yonghong-song wrote: cc @anakryiko @jemarch https://github.com/llvm/llvm-project/pull/84874 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [Clang][BPF] Allow sign extension for int type call parameters (PR #84874)

2024-03-11 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang @llvm/pr-subscribers-clang-codegen Author: None (yonghong-song) Changes Pu Lehui (pulehui@huaweicloud.com) reported an issue in private that at no_alu32 mode clang may generate code which produced incorrect result with riscv architecture. The

[clang] [llvm] [Clang][BPF] Allow sign extension for int type call parameters (PR #84874)

2024-03-11 Thread via cfe-commits
https://github.com/yonghong-song created https://github.com/llvm/llvm-project/pull/84874 Pu Lehui (pule...@huaweicloud.com) reported an issue in private that at no_alu32 mode clang may generate code which produced incorrect result with riscv architecture. The affected bpf prog is