[llvm] 012819f - [Attributor][FIX] Update the call graph properly when internalizing functions
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 19 23:48:05 PDT 2020
Author: Johannes Doerfert
Date: 2020-08-20T01:44:58-05:00
New Revision: 012819f30183200230d20655595481d596ac35ab
URL: https://github.com/llvm/llvm-project/commit/012819f30183200230d20655595481d596ac35ab
DIFF: https://github.com/llvm/llvm-project/commit/012819f30183200230d20655595481d596ac35ab.diff
LOG: [Attributor][FIX] Update the call graph properly when internalizing functions
The internal version is now part of the SCC, make sure to perform this
update.
Added:
Modified:
llvm/lib/Transforms/IPO/Attributor.cpp
llvm/test/Transforms/Attributor/internalize.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index 6cd3e059c3a1..1fcc4dd18198 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -2223,7 +2223,7 @@ static bool runAttributorOnFunctions(InformationCache &InfoCache,
Functions.insert(NewF);
// Update call graph
- CGUpdater.registerOutlinedFunction(*NewF);
+ CGUpdater.replaceFunctionWith(*F, *NewF);
for (const Use &U : NewF->uses())
if (CallBase *CB = dyn_cast<CallBase>(U.getUser())) {
auto *CallerF = CB->getCaller();
diff --git a/llvm/test/Transforms/Attributor/internalize.ll b/llvm/test/Transforms/Attributor/internalize.ll
index 7773bfbb2050..e0e064bb3e59 100644
--- a/llvm/test/Transforms/Attributor/internalize.ll
+++ b/llvm/test/Transforms/Attributor/internalize.ll
@@ -141,3 +141,33 @@ entry:
%ret4 = call i32 @inner4(i32 %ret3, i32 %ret3)
ret i32 %ret4
}
+
+
+define linkonce_odr void @unused_arg(i8) {
+; CHECK_DISABLED-LABEL: define {{[^@]+}}@unused_arg
+; CHECK_DISABLED-SAME: (i8 [[TMP0:%.*]])
+; CHECK_DISABLED-NEXT: unreachable
+;
+ unreachable
+}
+
+define void @unused_arg_caller() {
+; CHECK_DISABLED-LABEL: define {{[^@]+}}@unused_arg_caller()
+; CHECK_DISABLED-NEXT: call void @unused_arg(i8 0)
+; CHECK_DISABLED-NEXT: ret void
+;
+; IS__TUNIT_____ENABLED: Function Attrs: nofree noreturn nosync nounwind readnone willreturn
+; IS__TUNIT_____ENABLED-LABEL: define {{[^@]+}}@unused_arg_caller()
+; IS__TUNIT_____ENABLED-NEXT: unreachable
+;
+; IS__CGSCC_____ENABLED: Function Attrs: nofree norecurse noreturn nosync nounwind readnone willreturn
+; IS__CGSCC_____ENABLED-LABEL: define {{[^@]+}}@unused_arg_caller()
+; IS__CGSCC_____ENABLED-NEXT: unreachable
+;
+; DWRAPPER: Function Attrs: nofree norecurse noreturn nosync nounwind readnone willreturn
+; DWRAPPER-LABEL: define {{[^@]+}}@unused_arg_caller()
+; DWRAPPER-NEXT: unreachable
+;
+ call void @unused_arg(i8 0)
+ ret void
+}
More information about the llvm-commits
mailing list