instead of static casting a MCExpr to MCSymbolRefExpr directly, use dyn_cast and added null check.
Also removed an unnecessary (?) assertion
Paths
| Differential D42564
[WebAssembly] ignore non-SymbolRef MCExpr. Needs ReviewPublic Authored by patcheng on Jan 26 2018, 12:02 AM. This revision needs review, but there are no reviewers specified.
Details
Summary instead of static casting a MCExpr to MCSymbolRefExpr directly, use dyn_cast and added null check. Also removed an unnecessary (?) assertion
Diff Detail Event TimelineHerald added subscribers: llvm-commits, sunfish, aheejin and 4 others. · View Herald TranscriptJan 26 2018, 12:02 AM
Comment Actions I messed up the diff. I will upload a correct one soon. hopefully with detail on the case that were hitting the code in the original diff. Comment Actions I rolled back the changes to ignore non-MCSymbolExpr. Here is a dump of the MCExpr that I was encountering around line 1260 (in the for loop that's handling weak aliases. $Ss10_ArrayBodyVN : isExternal: true isInSection: true isRegistered: true isUsed: true isVariable: true dumpMCExpr: Binary: opCode: Add LHS dumpMCExpr: Symbol: $Ss10_ArrayBodyVMf RHS dumpMCExpr: Constant: 4
Revision Contents
Diff 131731 include/llvm/Object/Wasm.h
lib/MC/WasmObjectWriter.cpplib/Object/WasmObjectFile.cpp
test/tools/llvm-objdump/wasm.txt
tools/llvm-readobj/WasmDumper.cpp
tools/obj2yaml/wasm2yaml.cpp
|
Why is this unnecessary? Were you hitting this case? Perhaps we need a test that triggers this? Also, if this is unrelated to the MCSymbolRefExpr change than perhaps make it a separate change?