[PATCH] D155894: [BPF] Do not miscompile, allow external calls
Eduard Zingerman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 24 15:10:43 PDT 2023
eddyz87 added a comment.
In D155894#4529763 <https://reviews.llvm.org/D155894#4529763>, @tamird wrote:
> In D155894#4529756 <https://reviews.llvm.org/D155894#4529756>, @eddyz87 wrote:
>
>>> This reproduces in the aya integration tests in this PR on this commit: https://github.com/aya-rs/bpf-linker/pull/77/commits/6624b7d673a7b65cc634e94a4a8a63f79aa90f64
>>>
>>> It's not exactly a simple repro. I can try to give you just the IR if that'd be helpful?
>>
>> Yes, please, that would be helpful.
>
> https://gist.github.com/tamird/f3ff414f183b085c3e37cd7d5b5754de
I use a reasonably fresh LLVM main (`88b6d291bbdf`) with the following debug print:
diff --git a/llvm/lib/Target/BPF/BPFISelLowering.cpp b/llvm/lib/Target/BPF/BPFISelLowering.cpp
index 83a4bfb2f758..7937f8918fc8 100644
--- a/llvm/lib/Target/BPF/BPFISelLowering.cpp
+++ b/llvm/lib/Target/BPF/BPFISelLowering.cpp
@@ -455,6 +455,8 @@ SDValue BPFTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
InGlue = Chain.getValue(1);
}
+ llvm::dbgs() << "Callee: ";
+ Callee.dump();
// If the callee is a GlobalAddress node (quite common, every direct call is)
// turn it into a TargetGlobalAddress node so that legalize doesn't hack it.
// Likewise ExternalSymbol -> TargetExternalSymbol.
I try to `llc` the above gist and see the following:
$ llc -mcpu=v3 extern-builtins-from-tamird.ll -o /dev/null && echo "done"
Callee: t10: i64 = Constant<1>
Callee: t81: i64 = Constant<25>
Callee: t8: i64 = Constant<1>
Callee: t81: i64 = Constant<25>
Callee: t8: i64 = Constant<1>
Callee: t81: i64 = Constant<25>
Callee: t8: i64 = Constant<1>
Callee: t82: i64 = Constant<25>
Callee: t8: i64 = Constant<1>
Callee: t81: i64 = Constant<25>
Callee: t8: i64 = Constant<1>
Callee: t81: i64 = Constant<25>
done
It looks like the `ExternalSymbolSDNode` branch is not triggered by the gist :(
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155894/new/
https://reviews.llvm.org/D155894
More information about the llvm-commits
mailing list