[PATCH] D155894: [BPF] Do not miscompile, allow external calls
Tamir Duberstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 26 07:07:57 PDT 2023
tamird updated this revision to Diff 544354.
tamird added a comment.
Updated to only allow external calls.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155894/new/
https://reviews.llvm.org/D155894
Files:
llvm/lib/Target/BPF/BPFISelLowering.cpp
llvm/test/CodeGen/BPF/warn-call.ll
Index: llvm/test/CodeGen/BPF/warn-call.ll
===================================================================
--- llvm/test/CodeGen/BPF/warn-call.ll
+++ llvm/test/CodeGen/BPF/warn-call.ll
@@ -1,11 +1,10 @@
-; RUN: not llc -march=bpfel < %s 2>&1 >/dev/null | FileCheck %s
+; RUN: llc -march=bpfel < %s | FileCheck %s
-; CHECK: error: warn_call.c
-; CHECK: built-in function 'memcpy'
define ptr @warn(ptr returned, ptr, i64) local_unnamed_addr #0 !dbg !6 {
tail call void @llvm.dbg.value(metadata ptr %0, i64 0, metadata !14, metadata !17), !dbg !18
tail call void @llvm.dbg.value(metadata ptr %1, i64 0, metadata !15, metadata !17), !dbg !19
tail call void @llvm.dbg.value(metadata i64 %2, i64 0, metadata !16, metadata !17), !dbg !20
+; CHECK: call memcpy
tail call void @llvm.memcpy.p0.p0.i64(ptr %0, ptr %1, i64 %2, i1 false), !dbg !21
%4 = tail call ptr @foo(ptr %0, ptr %1, i64 %2) #5, !dbg !22
%5 = tail call fastcc ptr @bar(ptr %0), !dbg !23
Index: llvm/lib/Target/BPF/BPFISelLowering.cpp
===================================================================
--- llvm/lib/Target/BPF/BPFISelLowering.cpp
+++ llvm/lib/Target/BPF/BPFISelLowering.cpp
@@ -463,9 +463,6 @@
G->getOffset(), 0);
} else if (ExternalSymbolSDNode *E = dyn_cast<ExternalSymbolSDNode>(Callee)) {
Callee = DAG.getTargetExternalSymbol(E->getSymbol(), PtrVT, 0);
- fail(CLI.DL, DAG, Twine("A call to built-in function '"
- + StringRef(E->getSymbol())
- + "' is not supported."));
}
// Returns a chain & a flag for retval copy to use.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155894.544354.patch
Type: text/x-patch
Size: 1640 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230726/3a40d6b6/attachment.bin>
More information about the llvm-commits
mailing list