summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2016-12-22 05:27:12 +0000
committerAdrian Prantl <aprantl@apple.com>2016-12-22 05:27:12 +0000
commit49797ca6be3f13148dc8a92681579a3278519d06 (patch)
tree465a4157921bb722005fa76c96c69e5b428842fd /llvm/lib/Transforms
parentb458841745c1aa624d776c7a198ed2ec12d8621f (diff)
downloadbcm5719-llvm-49797ca6be3f13148dc8a92681579a3278519d06.tar.gz
bcm5719-llvm-49797ca6be3f13148dc8a92681579a3278519d06.zip
Refactor the DIExpression fragment query interface (NFC)
... so it becomes available to DIExpressionCursor. llvm-svn: 290322
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/SROA.cpp8
-rw-r--r--llvm/lib/Transforms/Utils/Local.cpp5
2 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp
index 887818bfdde..bfcb15530ef 100644
--- a/llvm/lib/Transforms/Scalar/SROA.cpp
+++ b/llvm/lib/Transforms/Scalar/SROA.cpp
@@ -4026,13 +4026,13 @@ bool SROA::splitAlloca(AllocaInst &AI, AllocaSlices &AS) {
if (Fragment.Size < AllocaSize || Expr->isFragment()) {
// If this alloca is already a scalar replacement of a larger aggregate,
// Fragment.Offset describes the offset inside the scalar.
- uint64_t Offset =
- Expr->isFragment() ? Expr->getFragmentOffsetInBits() : 0;
+ auto ExprFragment = Expr->getFragmentInfo();
+ uint64_t Offset = ExprFragment ? ExprFragment->OffsetInBits : 0;
uint64_t Start = Offset + Fragment.Offset;
uint64_t Size = Fragment.Size;
- if (Expr->isFragment()) {
+ if (ExprFragment) {
uint64_t AbsEnd =
- Expr->getFragmentOffsetInBits() + Expr->getFragmentSizeInBits();
+ ExprFragment->OffsetInBits + ExprFragment->SizeInBits;
if (Start >= AbsEnd)
// No need to describe a SROAed padding.
continue;
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index 6de0f34e94c..6e4174aa0cd 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -1112,9 +1112,10 @@ void llvm::ConvertDebugDeclareToDebugValue(DbgDeclareInst *DDI,
unsigned FragmentOffset = 0;
// If this already is a bit fragment, we drop the bit fragment from the
// expression and record the offset.
- if (DIExpr->isFragment()) {
+ auto Fragment = DIExpr->getFragmentInfo();
+ if (Fragment) {
Ops.append(DIExpr->elements_begin(), DIExpr->elements_end()-3);
- FragmentOffset = DIExpr->getFragmentOffsetInBits();
+ FragmentOffset = Fragment->OffsetInBits;
} else {
Ops.append(DIExpr->elements_begin(), DIExpr->elements_end());
}
OpenPOWER on IntegriCloud