Skip to content

Commit c2a61ef

Browse files
committed
Revert "[CallGraph] Ignore callback uses"
This likely has broken test/Transforms/Attributor/IPConstantProp/ tests. http://45.33.8.238/linux/22502/step_12.txt This reverts commit 205dc09.
1 parent 98eec77 commit c2a61ef

4 files changed

Lines changed: 7 additions & 69 deletions

File tree

‎llvm/include/llvm/IR/Function.h‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -830,11 +830,9 @@ class Function : public GlobalObject, public ilist_node<Function> {
830830

831831
/// hasAddressTaken - returns true if there are any uses of this function
832832
/// other than direct calls or invokes to it, or blockaddress expressions.
833-
/// Optionally passes back an offending user for diagnostic purposes and
834-
/// ignores callback uses.
833+
/// Optionally passes back an offending user for diagnostic purposes.
835834
///
836-
bool hasAddressTaken(const User ** = nullptr,
837-
bool IgnoreCallbackUses = false) const;
835+
bool hasAddressTaken(const User** = nullptr) const;
838836

839837
/// isDefTriviallyDead - Return true if it is trivially safe to remove
840838
/// this function definition from the module (because it isn't externally

‎llvm/lib/Analysis/CallGraph.cpp‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,9 @@ bool CallGraph::invalidate(Module &, const PreservedAnalyses &PA,
7777
void CallGraph::addToCallGraph(Function *F) {
7878
CallGraphNode *Node = getOrInsertFunction(F);
7979

80-
bool IgnoreCallbackUses = true;
81-
82-
// If this function has external linkage or has its address taken and
83-
// it is not a callback, then anything could call it.
84-
if (!F->hasLocalLinkage() || F->hasAddressTaken(nullptr, IgnoreCallbackUses))
80+
// If this function has external linkage or has its address taken, anything
81+
// could call it.
82+
if (!F->hasLocalLinkage() || F->hasAddressTaken())
8583
ExternalCallingNode->addCalledFunction(nullptr, Node);
8684

8785
populateCallGraphNode(Node);

‎llvm/lib/IR/Function.cpp‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "llvm/ADT/SmallVector.h"
2121
#include "llvm/ADT/StringExtras.h"
2222
#include "llvm/ADT/StringRef.h"
23-
#include "llvm/IR/AbstractCallSite.h"
2423
#include "llvm/IR/Argument.h"
2524
#include "llvm/IR/Attributes.h"
2625
#include "llvm/IR/BasicBlock.h"
@@ -1485,18 +1484,12 @@ Optional<Function *> Intrinsic::remangleIntrinsicFunction(Function *F) {
14851484
}
14861485

14871486
/// hasAddressTaken - returns true if there are any uses of this function
1488-
/// other than direct calls or invokes to it. Optionally ignores callback
1489-
/// uses.
1490-
bool Function::hasAddressTaken(const User **PutOffender,
1491-
bool IgnoreCallbackUses) const {
1487+
/// other than direct calls or invokes to it.
1488+
bool Function::hasAddressTaken(const User* *PutOffender) const {
14921489
for (const Use &U : uses()) {
14931490
const User *FU = U.getUser();
14941491
if (isa<BlockAddress>(FU))
14951492
continue;
1496-
1497-
if (IgnoreCallbackUses && AbstractCallSite(&U))
1498-
continue;
1499-
15001493
const auto *Call = dyn_cast<CallBase>(FU);
15011494
if (!Call) {
15021495
if (PutOffender)

‎llvm/test/Analysis/CallGraph/ignore-callback-uses.ll‎

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)