aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
diff options
context:
space:
mode:
authorChih-Ping Chen <chih-ping.chen@intel.com>2021-08-30 15:05:24 -0400
committerChih-Ping Chen <chih-ping.chen@intel.com>2021-08-30 15:36:54 -0400
commit070090cfa57f282e64ef355d2f8b8232bddedaf5 (patch)
treeb362ba25843586e6274ec4098c178364713bfa8b /llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
parent47b239eb5a17065d13c317600c46e56ffe2d6c75 (diff)
downloadllvm-070090cfa57f282e64ef355d2f8b8232bddedaf5.zip
llvm-070090cfa57f282e64ef355d2f8b8232bddedaf5.tar.gz
llvm-070090cfa57f282e64ef355d2f8b8232bddedaf5.tar.bz2
[DebugInfo] Remove the restriction on the size of DIStringType
in DebugHandlerBase::isUnsignedDIType. Differential Revision: https://reviews.llvm.org/D108559
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp b/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
index c81288c..c957ca8 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
@@ -174,12 +174,16 @@ uint64_t DebugHandlerBase::getBaseTypeSize(const DIType *Ty) {
}
bool DebugHandlerBase::isUnsignedDIType(const DIType *Ty) {
- // SROA may generate dbg value intrinsics to assign an unsigned value to a
- // Fortran CHARACTER(1) type variables. Make them as unsigned.
if (isa<DIStringType>(Ty)) {
- assert((Ty->getSizeInBits()) == 8 && "Not a valid unsigned type!");
+ // Some transformations (e.g. instcombine) may decide to turn a Fortran
+ // character object into an integer, and later ones (e.g. SROA) may
+ // further inject a constant integer in a llvm.dbg.value call to track
+ // the object's value. Here we trust the transformations are doing the
+ // right thing, and treat the constant as unsigned to preserve that value
+ // (i.e. avoid sign extension).
return true;
}
+
if (auto *CTy = dyn_cast<DICompositeType>(Ty)) {
// FIXME: Enums without a fixed underlying type have unknown signedness
// here, leading to incorrectly emitted constants.