diff options
author | Richard Trieu <rtrieu@google.com> | 2017-09-07 23:20:35 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2017-09-07 23:20:35 +0000 |
commit | c7828ebea4e774d8f576292b6ac9ee90836cc6d2 (patch) | |
tree | a51926b953d304f9e030c4aff385698f7706b689 /llvm/lib | |
parent | b7d0be58966a3a0747d2ad403616962617b0d5af (diff) | |
download | bcm5719-llvm-c7828ebea4e774d8f576292b6ac9ee90836cc6d2.tar.gz bcm5719-llvm-c7828ebea4e774d8f576292b6ac9ee90836cc6d2.zip |
Revert r312318, r312325, r312424, r312489
r312318 - Debug info for variables whose type is shrinked to bool
r312325, r312424, r312489 - Test case for r312318
Revision 312318 introduced a null dereference bug.
Details in https://bugs.llvm.org/show_bug.cgi?id=34490
llvm-svn: 312758
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp | 1 | ||||
-rw-r--r-- | llvm/lib/IR/DebugInfoMetadata.cpp | 1 | ||||
-rw-r--r-- | llvm/lib/Transforms/IPO/GlobalOpt.cpp | 38 |
3 files changed, 1 insertions, 39 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp index 429269d36d8..4538bb3ff02 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp @@ -338,7 +338,6 @@ void DwarfExpression::addExpression(DIExpressionCursor &&ExprCursor, break; case dwarf::DW_OP_plus: case dwarf::DW_OP_minus: - case dwarf::DW_OP_mul: emitOp(Op->getOp()); break; case dwarf::DW_OP_deref: diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp index 8f6822e3c97..005aac821f9 100644 --- a/llvm/lib/IR/DebugInfoMetadata.cpp +++ b/llvm/lib/IR/DebugInfoMetadata.cpp @@ -643,7 +643,6 @@ bool DIExpression::isValid() const { case dwarf::DW_OP_plus_uconst: case dwarf::DW_OP_plus: case dwarf::DW_OP_minus: - case dwarf::DW_OP_mul: case dwarf::DW_OP_deref: case dwarf::DW_OP_xderef: break; diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp index 8d4bde40968..ee8fdaebbda 100644 --- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp +++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp @@ -36,7 +36,6 @@ #include "llvm/IR/Module.h" #include "llvm/IR/Operator.h" #include "llvm/IR/ValueHandle.h" -#include "llvm/IR/DebugInfoMetadata.h" #include "llvm/Pass.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" @@ -1604,47 +1603,12 @@ static bool TryToShrinkGlobalToBoolean(GlobalVariable *GV, Constant *OtherVal) { assert(InitVal->getType() != Type::getInt1Ty(GV->getContext()) && "No reason to shrink to bool!"); - SmallVector<DIGlobalVariableExpression *, 1> GVs; - GV->getDebugInfo(GVs); - // If initialized to zero and storing one into the global, we can use a cast // instead of a select to synthesize the desired value. bool IsOneZero = false; - if (ConstantInt *CI = dyn_cast<ConstantInt>(OtherVal)){ + if (ConstantInt *CI = dyn_cast<ConstantInt>(OtherVal)) IsOneZero = InitVal->isNullValue() && CI->isOne(); - ConstantInt *CIInit = dyn_cast<ConstantInt>(GV->getInitializer()); - uint64_t ValInit = CIInit->getZExtValue(); - uint64_t ValOther = CI->getZExtValue(); - uint64_t ValMinus = ValOther - ValInit; - - for(auto *GVe : GVs){ - DIGlobalVariable *DGV = GVe->getVariable(); - DIExpression *E = GVe->getExpression(); - - // val * (ValOther - ValInit) + ValInit: - // DW_OP_deref DW_OP_constu <ValMinus> - // DW_OP_mul DW_OP_constu <ValInit> DW_OP_plus DW_OP_stack_value - E = DIExpression::get(NewGV->getContext(), - {dwarf::DW_OP_deref, - dwarf::DW_OP_constu, - ValMinus, - dwarf::DW_OP_mul, - dwarf::DW_OP_constu, - ValInit, - dwarf::DW_OP_plus, - dwarf::DW_OP_stack_value}); - DIGlobalVariableExpression *DGVE = - DIGlobalVariableExpression::get(NewGV->getContext(), DGV, E); - NewGV->addDebugInfo(DGVE); - } - } else { - // FIXME: This will only emit address for debugger on which will - // be written only 0 or 1. - for(auto *GV : GVs) - NewGV->addDebugInfo(GV); - } - while (!GV->use_empty()) { Instruction *UI = cast<Instruction>(GV->user_back()); if (StoreInst *SI = dyn_cast<StoreInst>(UI)) { |