[llvm] r256329 - [OperandBundles] Have GlobalsModRef play nice with operand bundles
David Majnemer via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 23 01:58:47 PST 2015
Author: majnemer
Date: Wed Dec 23 03:58:46 2015
New Revision: 256329
URL: http://llvm.org/viewvc/llvm-project?rev=256329&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp
llvm/trunk/lib/Analysis/GlobalsModRef.cpp
llvm/trunk/test/Analysis/GlobalsModRef/nocapture.ll
Modified: llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp?rev=256329&r1=256328&r2=256329&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp (original)
+++ llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp Wed Dec 23 03:58:46 2015
@@ -167,10 +167,9 @@ bool AAEval::runOnFunction(Function &F)
if (!isa<Function>(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.
Modified: llvm/trunk/lib/Analysis/GlobalsModRef.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/GlobalsModRef.cpp?rev=256329&r1=256328&r2=256329&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/GlobalsModRef.cpp (original)
+++ llvm/trunk/lib/Analysis/GlobalsModRef.cpp Wed Dec 23 03:58:46 2015
@@ -353,12 +353,12 @@ bool GlobalsAAResult::AnalyzeUsesOfPoint
} 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.
Modified: llvm/trunk/test/Analysis/GlobalsModRef/nocapture.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/GlobalsModRef/nocapture.ll?rev=256329&r1=256328&r2=256329&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/GlobalsModRef/nocapture.ll (original)
+++ llvm/trunk/test/Analysis/GlobalsModRef/nocapture.ll Wed Dec 23 03:58:46 2015
@@ -1,4 +1,4 @@
-; RUN: opt < %s -globals-aa -aa-eval -print-all-alias-modref-info -S 2>&1 | FileCheck %s
+; RUN: opt < %s -globals-aa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.10.0"
@@ -45,3 +45,13 @@ entry:
store i32 %add, i32* %q, align 4
ret i32 4
}
+
+declare void @g3()
+
+; CHECK-LABEL: Function: f3
+; CHECK: NoAlias: i32* %p, i32* @b
+define void @f3(i32* nocapture readonly %p) {
+entry:
+ tail call void @g3() [ "deopt"(i32* @b, i32 *%p) ]
+ unreachable
+}
More information about the llvm-commits
mailing list