Skip to content

Commit 94830bf

Browse files
committed
[WebAssembly] Use SetVector to stabilize iteration order after D120365
StringMap iteration order is not guaranteed to be deterministic (https://llvm.org/docs/ProgrammersManual.html#llvm-adt-stringmap-h).
1 parent 47ccfd7 commit 94830bf

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

llvm/include/llvm/CodeGen/MachineModuleInfoImpls.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#define LLVM_CODEGEN_MACHINEMODULEINFOIMPLS_H
1616

1717
#include "llvm/ADT/DenseMap.h"
18-
#include "llvm/ADT/StringSet.h"
18+
#include "llvm/ADT/SetVector.h"
1919
#include "llvm/CodeGen/MachineModuleInfo.h"
2020
#include <cassert>
2121

@@ -110,7 +110,7 @@ class MachineModuleInfoWasm : public MachineModuleInfoImpl {
110110
public:
111111
MachineModuleInfoWasm(const MachineModuleInfo &) {}
112112

113-
StringSet<> MachineSymbolsUsed;
113+
SetVector<StringRef> MachineSymbolsUsed;
114114
};
115115

116116
} // end namespace llvm

llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,8 @@ void WebAssemblyAsmPrinter::emitDecls(const Module &M) {
303303
// only find symbols that have been used. Unused symbols from globals will
304304
// not be found here.
305305
MachineModuleInfoWasm &MMIW = MMI->getObjFileInfo<MachineModuleInfoWasm>();
306-
for (const auto &Name : MMIW.MachineSymbolsUsed) {
307-
auto *WasmSym = cast<MCSymbolWasm>(getOrCreateWasmSymbol(Name.getKey()));
306+
for (StringRef Name : MMIW.MachineSymbolsUsed) {
307+
auto *WasmSym = cast<MCSymbolWasm>(getOrCreateWasmSymbol(Name));
308308
if (WasmSym->isFunction()) {
309309
// TODO(wvo): is there any case where this overlaps with the call to
310310
// emitFunctionType in the loop below?

llvm/test/CodeGen/WebAssembly/functype-emission.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
; Demonstrates that appropriate .functype directives are emitted for defined
44
; functions, declared functions, and any libcalls.
55

6-
; CHECK: .functype __unordtf2 (i64, i64, i64, i64) -> (i32)
76
; CHECK: .functype __multi3 (i32, i64, i64, i64, i64) -> ()
7+
; CHECK: .functype __unordtf2 (i64, i64, i64, i64) -> (i32)
88
; CHECK: .functype defined_fun_1 (f64) -> (i64)
99
; CHECK: .functype defined_fun_2 (f64, i32) -> (i64)
1010
; CHECK: .functype declared_fun (i32, f32, i64) -> (i32)

0 commit comments

Comments
 (0)