[PATCH] D132764: [LazyCallGraph] Update libcall list when replacing a libcall node's function
Arthur Eubanks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 27 11:08:52 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7a94d189ad1a: [LazyCallGraph] Update libcall list when replacing a libcall node's function (authored by aeubanks).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132764/new/
https://reviews.llvm.org/D132764
Files:
llvm/lib/Analysis/LazyCallGraph.cpp
llvm/test/Analysis/LazyCallGraph/replace-libcall.ll
Index: llvm/test/Analysis/LazyCallGraph/replace-libcall.ll
===================================================================
--- /dev/null
+++ llvm/test/Analysis/LazyCallGraph/replace-libcall.ll
@@ -0,0 +1,17 @@
+; RUN: opt -passes=inline,argpromotion < %s -S | FileCheck %s
+
+; Make sure we update the list of libcalls when we replace a libcall.
+
+; CHECK: define {{.*}}@a
+
+define void @a() {
+entry:
+ %call = call float @strtof(ptr noundef null, ptr noundef null)
+ ret void
+}
+
+define internal float @strtof(ptr noundef %0, ptr noundef %1) nounwind {
+entry:
+ ret float 0.0
+}
+
Index: llvm/lib/Analysis/LazyCallGraph.cpp
===================================================================
--- llvm/lib/Analysis/LazyCallGraph.cpp
+++ llvm/lib/Analysis/LazyCallGraph.cpp
@@ -1484,6 +1484,12 @@
// Update various call graph maps.
G->NodeMap.erase(&OldF);
G->NodeMap[&NewF] = &N;
+
+ // Update lib functions.
+ if (G->isLibFunction(OldF)) {
+ G->LibFunctions.remove(&OldF);
+ G->LibFunctions.insert(&NewF);
+ }
}
void LazyCallGraph::insertEdge(Node &SourceN, Node &TargetN, Edge::Kind EK) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132764.456135.patch
Type: text/x-patch
Size: 1126 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220827/44cd1e82/attachment.bin>
More information about the llvm-commits
mailing list