diff options
author | hsmahesha <mahesha.comp@gmail.com> | 2021-11-10 08:44:58 +0530 |
---|---|---|
committer | hsmahesha <mahesha.comp@gmail.com> | 2021-11-10 08:45:21 +0530 |
commit | 3b9a85d10ac7a073c95b35adca379281ac6ecbcb (patch) | |
tree | 68fce34e05c974839e1785c8c00cf883dbcf13d5 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | 5b7ea8e62921e53fdea73d948eb0d48c071d4b73 (diff) | |
download | llvm-3b9a85d10ac7a073c95b35adca379281ac6ecbcb.zip llvm-3b9a85d10ac7a073c95b35adca379281ac6ecbcb.tar.gz llvm-3b9a85d10ac7a073c95b35adca379281ac6ecbcb.tar.bz2 |
[CFE][Codegen] Make sure to maintain the contiguity of all the static allocas
at the start of the entry block, which in turn would aid better code transformation/optimization.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D110257
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index c3c2899..d87cf2d 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -424,6 +424,14 @@ void CodeGenFunction::FinishFunction(SourceLocation EndLoc) { AllocaInsertPt = nullptr; Ptr->eraseFromParent(); + // PostAllocaInsertPt, if created, was lazily created when it was required, + // remove it now since it was just created for our own convenience. + if (PostAllocaInsertPt) { + llvm::Instruction *PostPtr = PostAllocaInsertPt; + PostAllocaInsertPt = nullptr; + PostPtr->eraseFromParent(); + } + // If someone took the address of a label but never did an indirect goto, we // made a zero entry PHI node, which is illegal, zap it now. if (IndirectBranch) { |