[PATCH] D41742: [MSF] Fix FPM interval calculation

Colden Cullen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 4 16:39:47 PST 2018


colden added inline comments.


================
Comment at: llvm/include/llvm/DebugInfo/MSF/MSFCommon.h:143
+  return getNumFpmIntervals(L.SB->BlockSize, L.SB->NumBlocks,
+                            IncludeUnusedFpmData, AltFpm ? 2 : 1);
 }
----------------
Sorry maybe I wasn't super clear before, but if you look at MSFCommon.cpp, getFpmStreamLayout, the AltFpm parameter there doesn't actually specify which Fpm block to use, but whether or not to use the Fpm block NOT referenced by the layout. To match that functionality, this should look more like:
```
int Fpm = L.SB->FreeBlockMapBlock;
return getNumFpmIntervals(L.SB->BlockSize, L.SB->NumBlocks,
                            IncludeUnusedFpmData, AltFpm ? 3U - Fpm  : Fpm);
```
Otherwise you could end up in situations where your active FPM is 2, but you want to initialize 1, so you pass true for AltFpm. That just gets you 2 anyway. This is how it's used in PDBFileBuilder::commitFpm, when it initializes the second Fpm but never uses it.


https://reviews.llvm.org/D41742





More information about the llvm-commits mailing list