summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorVictor Leschuk <vleschuk@accesssoftek.com>2017-08-04 04:43:54 +0000
committerVictor Leschuk <vleschuk@accesssoftek.com>2017-08-04 04:43:54 +0000
commit21713ebfb147d15f397fda9dbb78013fc6515b09 (patch)
tree91b0ec56cd2cd37f5ea24ba0a0f1044a09a70899 /llvm/lib
parent0b48042a653b20fa30a9aa0b9642c08d573801ce (diff)
downloadbcm5719-llvm-21713ebfb147d15f397fda9dbb78013fc6515b09.tar.gz
bcm5719-llvm-21713ebfb147d15f397fda9dbb78013fc6515b09.zip
Revert r310014 as it breaks build lld-x86_64-darwin13
llvm-svn: 310020
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/IR/DIBuilder.cpp29
-rw-r--r--llvm/lib/Transforms/IPO/GlobalOpt.cpp35
2 files changed, 7 insertions, 57 deletions
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp
index f4702b377f9..972b6a22324 100644
--- a/llvm/lib/IR/DIBuilder.cpp
+++ b/llvm/lib/IR/DIBuilder.cpp
@@ -668,31 +668,10 @@ DIExpression *DIBuilder::createExpression(ArrayRef<int64_t> Signed) {
return createExpression(Addr);
}
-DIExpression *DIBuilder::createFragmentExpression(unsigned OffsetInBits,
- unsigned SizeInBits,
- const DIExpression *Expr) {
- SmallVector<uint64_t, 8> Ops;
- // Copy over the expression, but leave off any trailing DW_OP_LLVM_fragment.
- if (Expr) {
- for (auto Op : Expr->expr_ops()) {
- if (Op.getOp() == dwarf::DW_OP_LLVM_fragment) {
- // Make the new offset point into the existing fragment.
- uint64_t FragmentOffsetInBits = Op.getArg(0);
- uint64_t FragmentSizeInBits = Op.getArg(1);
- assert((OffsetInBits + SizeInBits <= FragmentSizeInBits) &&
- "new fragment outside of original fragment");
- OffsetInBits += FragmentOffsetInBits;
- break;
- }
- Ops.push_back(Op.getOp());
- for (unsigned I = 0; I < Op.getNumArgs(); ++I)
- Ops.push_back(Op.getArg(I));
- }
- }
- Ops.push_back(dwarf::DW_OP_LLVM_fragment);
- Ops.push_back(OffsetInBits);
- Ops.push_back(SizeInBits);
- return DIExpression::get(VMContext, Ops);
+DIExpression *DIBuilder::createFragmentExpression(unsigned OffsetInBytes,
+ unsigned SizeInBytes) {
+ uint64_t Addr[] = {dwarf::DW_OP_LLVM_fragment, OffsetInBytes, SizeInBytes};
+ return DIExpression::get(VMContext, Addr);
}
template <class... Ts>
diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp
index 890fef59c72..93eab680ca6 100644
--- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp
@@ -27,9 +27,7 @@
#include "llvm/IR/CallingConv.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
-#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DerivedTypes.h"
-#include "llvm/IR/DIBuilder.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/GetElementPtrTypeIterator.h"
#include "llvm/IR/Instructions.h"
@@ -421,23 +419,6 @@ static bool GlobalUsersSafeToSRA(GlobalValue *GV) {
return true;
}
-/// Copy over the debug info for a variable to its SRA replacements.
-static void transferSRADebugInfo(GlobalVariable *GV, GlobalVariable *NGV,
- uint64_t FragmentOffsetInBits,
- uint64_t FragmentSizeInBits) {
- DIBuilder DIB(*GV->getParent(), /*AllowUnresolved*/ false);
- SmallVector<DIGlobalVariableExpression *, 1> GVs;
- GV->getDebugInfo(GVs);
- for (auto *GVE : GVs) {
- DIVariable *Var = GVE->getVariable();
- DIExpression *Expr = GVE->getExpression();
- DIExpression *NExpr = DIB.createFragmentExpression(
- FragmentOffsetInBits, FragmentSizeInBits, Expr);
- auto *NGVE = DIGlobalVariableExpression::get(GVE->getContext(), Var, NExpr);
- NGV->addDebugInfo(NGVE);
- }
-}
-
/// Perform scalar replacement of aggregates on the specified global variable.
/// This opens the door for other optimizations by exposing the behavior of the
@@ -462,7 +443,6 @@ static GlobalVariable *SRAGlobal(GlobalVariable *GV, const DataLayout &DL) {
StartAlignment = DL.getABITypeAlignment(GV->getType());
if (StructType *STy = dyn_cast<StructType>(Ty)) {
- uint64_t FragmentOffset = 0;
NewGlobals.reserve(STy->getNumElements());
const StructLayout &Layout = *DL.getStructLayout(STy);
for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
@@ -485,22 +465,15 @@ static GlobalVariable *SRAGlobal(GlobalVariable *GV, const DataLayout &DL) {
unsigned NewAlign = (unsigned)MinAlign(StartAlignment, FieldOffset);
if (NewAlign > DL.getABITypeAlignment(STy->getElementType(i)))
NGV->setAlignment(NewAlign);
-
- // Copy over the debug info for the variable.
- FragmentOffset = alignTo(FragmentOffset, NewAlign);
- uint64_t Size = DL.getTypeSizeInBits(NGV->getValueType());
- transferSRADebugInfo(GV, NGV, FragmentOffset, Size);
- FragmentOffset += Size;
}
} else if (SequentialType *STy = dyn_cast<SequentialType>(Ty)) {
unsigned NumElements = STy->getNumElements();
if (NumElements > 16 && GV->hasNUsesOrMore(16))
return nullptr; // It's not worth it.
NewGlobals.reserve(NumElements);
- auto ElTy = STy->getElementType();
- uint64_t EltSize = DL.getTypeAllocSize(ElTy);
- unsigned EltAlign = DL.getABITypeAlignment(ElTy);
- uint64_t FragmentSizeInBits = DL.getTypeSizeInBits(ElTy);
+
+ uint64_t EltSize = DL.getTypeAllocSize(STy->getElementType());
+ unsigned EltAlign = DL.getABITypeAlignment(STy->getElementType());
for (unsigned i = 0, e = NumElements; i != e; ++i) {
Constant *In = Init->getAggregateElement(i);
assert(In && "Couldn't get element of initializer?");
@@ -521,8 +494,6 @@ static GlobalVariable *SRAGlobal(GlobalVariable *GV, const DataLayout &DL) {
unsigned NewAlign = (unsigned)MinAlign(StartAlignment, EltSize*i);
if (NewAlign > EltAlign)
NGV->setAlignment(NewAlign);
-
- transferSRADebugInfo(GV, NGV, FragmentSizeInBits * i, FragmentSizeInBits);
}
}
OpenPOWER on IntegriCloud