Add DidCallStackSave variable to CodeGenFunction.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64156 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp
index 5e005b4..153fcc8 100644
--- a/lib/CodeGen/CodeGenFunction.cpp
+++ b/lib/CodeGen/CodeGenFunction.cpp
@@ -144,6 +144,7 @@
llvm::Function *Fn,
const FunctionArgList &Args,
SourceLocation StartLoc) {
+ DidCallStackSave = false;
CurFuncDecl = D;
FnRetTy = RetTy;
CurFn = Fn;
diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h
index 58d3a73..0323094 100644
--- a/lib/CodeGen/CodeGenFunction.h
+++ b/lib/CodeGen/CodeGenFunction.h
@@ -260,6 +260,10 @@
/// which the stack depth changes.
llvm::Value *StackDepth;
+ /// DidCallStackSave - Whether llvm.stacksave has been called. Used to avoid
+ /// calling llvm.stacksave for multiple VLAs in the same scope.
+ bool DidCallStackSave;
+
/// StackSaveValues - A stack(!) of stack save values. When a new scope is
/// entered, a null is pushed on this stack. If a VLA is emitted, then the
/// return value of llvm.stacksave() is stored at the top of this stack.