diff options
author | Dehao Chen <dehao@google.com> | 2016-11-08 16:32:32 +0000 |
---|---|---|
committer | Dehao Chen <dehao@google.com> | 2016-11-08 16:32:32 +0000 |
commit | 2ca9be330b9b645c8bae9c5508799eaa69870aa1 (patch) | |
tree | 9898e3ccc66af17990e271c709f4b71768e9b674 /llvm/lib/Transforms/Utils | |
parent | 825e538559266a29fb94a46885e1d448fb381e3b (diff) | |
download | bcm5719-llvm-2ca9be330b9b645c8bae9c5508799eaa69870aa1.tar.gz bcm5719-llvm-2ca9be330b9b645c8bae9c5508799eaa69870aa1.zip |
Use the last 7 bits to represent the discriminator to fit it in 1 byte ULEB128 (NFC).
From experiments, discriminator is rarely greater than 127. Here we enforce it to be no greater than 127 so that it will always fit in 1 byte.
llvm-svn: 286245
Diffstat (limited to 'llvm/lib/Transforms/Utils')
-rw-r--r-- | llvm/lib/Transforms/Utils/AddDiscriminators.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Utils/AddDiscriminators.cpp b/llvm/lib/Transforms/Utils/AddDiscriminators.cpp index 66781ca76b4..2e95926c0b3 100644 --- a/llvm/lib/Transforms/Utils/AddDiscriminators.cpp +++ b/llvm/lib/Transforms/Utils/AddDiscriminators.cpp @@ -188,12 +188,13 @@ static bool addDiscriminators(Function &F) { continue; // If we could insert more than one block with the same line+file, a // discriminator is needed to distinguish both instructions. - unsigned Discriminator = R.second ? ++LDM[L] : LDM[L]; + // Only the lowest 7 bits are used to represent a discriminator to fit + // it in 1 byte ULEB128 representation. + unsigned Discriminator = (R.second ? ++LDM[L] : LDM[L]) & 0x7f; I.setDebugLoc(DIL->cloneWithDiscriminator(Discriminator)); DEBUG(dbgs() << DIL->getFilename() << ":" << DIL->getLine() << ":" - << DIL->getColumn() << ":" - << Discriminator << " " - << I << "\n"); + << DIL->getColumn() << ":" << Discriminator << " " << I + << "\n"); Changed = true; } } @@ -215,7 +216,8 @@ static bool addDiscriminators(Function &F) { Location L = std::make_pair(CurrentDIL->getFilename(), CurrentDIL->getLine()); if (!CallLocations.insert(L).second) { - Current->setDebugLoc(CurrentDIL->cloneWithDiscriminator(++LDM[L])); + Current->setDebugLoc( + CurrentDIL->cloneWithDiscriminator((++LDM[L]) & 0x7f)); Changed = true; } } |