1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

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
This commit is contained in:
Dehao Chen 2016-11-08 16:32:32 +00:00
parent 8c72d075d5
commit 9ef7dd39fb

View File

@ -188,12 +188,13 @@ static bool addDiscriminators(Function &F) {
continue; continue;
// If we could insert more than one block with the same line+file, a // If we could insert more than one block with the same line+file, a
// discriminator is needed to distinguish both instructions. // 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)); I.setDebugLoc(DIL->cloneWithDiscriminator(Discriminator));
DEBUG(dbgs() << DIL->getFilename() << ":" << DIL->getLine() << ":" DEBUG(dbgs() << DIL->getFilename() << ":" << DIL->getLine() << ":"
<< DIL->getColumn() << ":" << DIL->getColumn() << ":" << Discriminator << " " << I
<< Discriminator << " " << "\n");
<< I << "\n");
Changed = true; Changed = true;
} }
} }
@ -215,7 +216,8 @@ static bool addDiscriminators(Function &F) {
Location L = Location L =
std::make_pair(CurrentDIL->getFilename(), CurrentDIL->getLine()); std::make_pair(CurrentDIL->getFilename(), CurrentDIL->getLine());
if (!CallLocations.insert(L).second) { if (!CallLocations.insert(L).second) {
Current->setDebugLoc(CurrentDIL->cloneWithDiscriminator(++LDM[L])); Current->setDebugLoc(
CurrentDIL->cloneWithDiscriminator((++LDM[L]) & 0x7f));
Changed = true; Changed = true;
} }
} }