From 2bc253847095bfa2676c05df6a5243d08af84ca4 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Wed, 23 Dec 2015 09:58:46 +0000 Subject: [OperandBundles] Have GlobalsModRef play nice with operand bundles A call site's use of a Value might not correspond to an argument operand but to a bundle operand. llvm-svn: 256329 --- llvm/lib/Analysis/AliasAnalysisEvaluator.cpp | 7 +++---- llvm/lib/Analysis/GlobalsModRef.cpp | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'llvm/lib') diff --git a/llvm/lib/Analysis/AliasAnalysisEvaluator.cpp b/llvm/lib/Analysis/AliasAnalysisEvaluator.cpp index c2a95cc31ea..12917b650e5 100644 --- a/llvm/lib/Analysis/AliasAnalysisEvaluator.cpp +++ b/llvm/lib/Analysis/AliasAnalysisEvaluator.cpp @@ -167,10 +167,9 @@ bool AAEval::runOnFunction(Function &F) { if (!isa(Callee) && isInterestingPointer(Callee)) Pointers.insert(Callee); // Consider formals. - for (CallSite::arg_iterator AI = CS.arg_begin(), AE = CS.arg_end(); - AI != AE; ++AI) - if (isInterestingPointer(*AI)) - Pointers.insert(*AI); + for (Use &DataOp : CS.data_ops()) + if (isInterestingPointer(DataOp)) + Pointers.insert(DataOp); CallSites.insert(CS); } else { // Consider all operands. diff --git a/llvm/lib/Analysis/GlobalsModRef.cpp b/llvm/lib/Analysis/GlobalsModRef.cpp index 51a83d53277..ab2263ae374 100644 --- a/llvm/lib/Analysis/GlobalsModRef.cpp +++ b/llvm/lib/Analysis/GlobalsModRef.cpp @@ -353,12 +353,12 @@ bool GlobalsAAResult::AnalyzeUsesOfPointer(Value *V, } else if (auto CS = CallSite(I)) { // Make sure that this is just the function being called, not that it is // passing into the function. - if (!CS.isCallee(&U)) { + if (CS.isDataOperand(&U)) { // Detect calls to free. - if (isFreeCall(I, &TLI)) { + if (CS.isArgOperand(&U) && isFreeCall(I, &TLI)) { if (Writers) Writers->insert(CS->getParent()->getParent()); - } else if (CS.doesNotCapture(CS.getArgumentNo(&U))) { + } else if (CS.doesNotCapture(CS.getDataOperandNo(&U))) { Function *ParentF = CS->getParent()->getParent(); // A nocapture argument may be read from or written to, but does not // escape unless the call can somehow recurse. -- cgit v1.2.3