summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/Local.cpp
diff options
context:
space:
mode:
authorWolfgang Pieb <Wolfgang.Pieb@sony.com>2019-04-15 17:36:29 +0000
committerWolfgang Pieb <Wolfgang.Pieb@sony.com>2019-04-15 17:36:29 +0000
commit4fe42214e24227906c2d2be723465b8bef063ee8 (patch)
tree60c553aed9361cb30ad4f2cea6319722553598a3 /llvm/lib/Transforms/Utils/Local.cpp
parent3929c432e65c7d382e2d996f1d17c70fc66eabca (diff)
downloadbcm5719-llvm-4fe42214e24227906c2d2be723465b8bef063ee8.tar.gz
bcm5719-llvm-4fe42214e24227906c2d2be723465b8bef063ee8.zip
[DEBUGINFO] Prevent Instcombine from dropping debuginfo when removing zexts
Zexts can be treated like no-op casts when it comes to assessing whether their removal affects debug info. Reviewer: aprantl Differential Revision: https://reviews.llvm.org/D60641 llvm-svn: 358431
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/Local.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index 3110322b314..65d5928e99c 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -1666,11 +1666,10 @@ DIExpression *llvm::salvageDebugInfoImpl(Instruction &I,
};
if (auto *CI = dyn_cast<CastInst>(&I)) {
- if (!CI->isNoopCast(DL))
- return nullptr;
-
- // No-op casts are irrelevant for debug info.
- return SrcDIExpr;
+ // No-op casts and zexts are irrelevant for debug info.
+ if (CI->isNoopCast(DL) || isa<ZExtInst>(&I))
+ return SrcDIExpr;
+ return nullptr;
} else if (auto *GEP = dyn_cast<GetElementPtrInst>(&I)) {
unsigned BitWidth =
M.getDataLayout().getIndexSizeInBits(GEP->getPointerAddressSpace());
OpenPOWER on IntegriCloud