Reset NextFnNum in MachineModuleInfo::initialize
authorRoman Tereshin <rtereshin@apple.com>
Tue, 11 Aug 2020 06:29:39 +0000 (23:29 -0700)
committerDaniel Sanders <daniel_l_sanders@apple.com>
Mon, 19 Apr 2021 22:51:30 +0000 (15:51 -0700)
In an env that reuses compiler instances for multiple compilations, this
omission results in non-deterministic assembly output (names of the
auto-generated labels) if the order or full set of Modules compiled
varies.

Differential Revision: https://reviews.llvm.org/D100797

llvm/lib/CodeGen/MachineModuleInfo.cpp

index b436633..776b7f5 100644 (file)
@@ -196,6 +196,7 @@ void MMIAddrLabelMapCallbackPtr::allUsesReplacedWith(Value *V2) {
 void MachineModuleInfo::initialize() {
   ObjFileMMI = nullptr;
   CurCallSite = 0;
+  NextFnNum = 0;
   UsesMSVCFloatingPoint = UsesMorestackAddr = false;
   HasSplitStack = HasNosplitStack = false;
   AddrLabelSymbols = nullptr;