[llvm] f638364 - [StackSafety] Bailout on some function calls
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Wed May 27 02:50:14 PDT 2020
Author: Vitaly Buka
Date: 2020-05-27T02:48:42-07:00
New Revision: f6383643d9e84a139f68cbe19fa16d4969d20d5c
URL: https://github.com/llvm/llvm-project/commit/f6383643d9e84a139f68cbe19fa16d4969d20d5c
DIFF: https://github.com/llvm/llvm-project/commit/f6383643d9e84a139f68cbe19fa16d4969d20d5c.diff
LOG: [StackSafety] Bailout on some function calls
Don't miss values used in calls outside regular argument list.
Added:
Modified:
llvm/lib/Analysis/StackSafetyAnalysis.cpp
llvm/test/Analysis/StackSafetyAnalysis/local.ll
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/StackSafetyAnalysis.cpp b/llvm/lib/Analysis/StackSafetyAnalysis.cpp
index 9c937b0b1dda..a44732613c0f 100644
--- a/llvm/lib/Analysis/StackSafetyAnalysis.cpp
+++ b/llvm/lib/Analysis/StackSafetyAnalysis.cpp
@@ -345,12 +345,18 @@ bool StackSafetyLocalAnalysis::analyzeAllUses(Value *Ptr, UseInfo &US) {
assert(isa<Function>(Callee) || isa<GlobalAlias>(Callee));
auto B = CB.arg_begin(), E = CB.arg_end();
+ int Found = 0;
for (auto A = B; A != E; ++A) {
if (A->get() == V) {
+ ++Found;
ConstantRange Offset = offsetFrom(UI, Ptr);
US.Calls.emplace_back(Callee, A - B, Offset);
}
}
+ if (!Found) {
+ US.updateRange(UnknownRange);
+ return false;
+ }
break;
}
diff --git a/llvm/test/Analysis/StackSafetyAnalysis/local.ll b/llvm/test/Analysis/StackSafetyAnalysis/local.ll
index eeb7ccbe42d3..5dee4b52a2e4 100644
--- a/llvm/test/Analysis/StackSafetyAnalysis/local.ll
+++ b/llvm/test/Analysis/StackSafetyAnalysis/local.ll
@@ -412,3 +412,15 @@ entry:
%val = load %zerosize_type, %zerosize_type* %p, align 4
ret void
}
+
+define void @OperandBundle() {
+; CHECK-LABEL: @OperandBundle dso_preemptable{{$}}
+; CHECK-NEXT: args uses:
+; CHECK-NEXT: allocas uses:
+; CHECK-NEXT: a[4]: full-set
+; CHECK-NOT: ]:
+entry:
+ %a = alloca i32, align 4
+ call void @LeakAddress() ["unknown"(i32* %a)]
+ ret void
+}
More information about the llvm-commits
mailing list