Move discriminator assignment to where it is used. (NFC)
authorDehao Chen <dehao@google.com>
Tue, 25 Oct 2016 16:50:27 +0000 (16:50 +0000)
committerDehao Chen <dehao@google.com>
Tue, 25 Oct 2016 16:50:27 +0000 (16:50 +0000)
llvm-svn: 285084

llvm/lib/Transforms/Utils/AddDiscriminators.cpp

index a9b5d72..8120fa9 100644 (file)
@@ -199,8 +199,8 @@ static bool addDiscriminators(Function &F) {
       // discriminator is needed to distinguish both instructions.
       auto R1 = Scopes.insert({Scope, nullptr});
       DILexicalBlockFile *&NewScope = R1.first->second;
-      unsigned Discriminator = InsertSuccess ? ++LDM[L] : LDM[L];
       if (!NewScope) {
+        unsigned Discriminator = InsertSuccess ? ++LDM[L] : LDM[L];
         auto *File = Builder.createFile(DIL->getFilename(),
                                         Scope->getDirectory());
         NewScope = Builder.createLexicalBlockFile(Scope, File, Discriminator);