diff options
author | Alexey Lapshin <a.v.lapshin@mail.ru> | 2019-09-04 14:19:49 +0000 |
---|---|---|
committer | Alexey Lapshin <a.v.lapshin@mail.ru> | 2019-09-04 14:19:49 +0000 |
commit | cbf1f3b771c8c0e0858deafe5f9457fb838ff2c2 (patch) | |
tree | f60ff2ffc03ce529663ed821dbb7c0ba2b687b6f /llvm/lib/Transforms/Utils/Local.cpp | |
parent | c86d47b6b6fbece30c5ef7232a72c0d0453837cb (diff) | |
download | bcm5719-llvm-cbf1f3b771c8c0e0858deafe5f9457fb838ff2c2.tar.gz bcm5719-llvm-cbf1f3b771c8c0e0858deafe5f9457fb838ff2c2.zip |
[Debuginfo][SROA] Need to handle dbg.value in SROA pass.
SROA pass processes debug info incorrecly if applied twice.
Specifically, after SROA works first time, instcombine converts dbg.declare
intrinsics into dbg.value. Inlining creates new opportunities for SROA,
so it is called again. This time it does not handle correctly previously
inserted dbg.value intrinsics.
Differential Revision: https://reviews.llvm.org/D64595
llvm-svn: 370906
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index a1d1b3ec84f..7242eb1d3de 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -1378,7 +1378,12 @@ void llvm::ConvertDebugDeclareToDebugValue(DbgVariableIntrinsic *DII, /// Determine whether this alloca is either a VLA or an array. static bool isArray(AllocaInst *AI) { return AI->isArrayAllocation() || - AI->getType()->getElementType()->isArrayTy(); + (AI->getAllocatedType() && AI->getAllocatedType()->isArrayTy()); +} + +/// Determine whether this alloca is a structure. +static bool isStructure(AllocaInst *AI) { + return AI->getAllocatedType() && AI->getAllocatedType()->isStructTy(); } /// LowerDbgDeclare - Lowers llvm.dbg.declare intrinsics into appropriate set @@ -1403,7 +1408,7 @@ bool llvm::LowerDbgDeclare(Function &F) { // stored on the stack, while the dbg.declare can only describe // the stack slot (and at a lexical-scope granularity). Later // passes will attempt to elide the stack slot. - if (!AI || isArray(AI)) + if (!AI || isArray(AI) || isStructure(AI)) continue; // A volatile load/store means that the alloca can't be elided anyway. |