instead of static casting a MCExpr to MCSymbolRefExpr directly, use dyn_cast and added null check.
Also removed an unnecessary (?) assertion
Differential D42564
[WebAssembly] ignore non-SymbolRef MCExpr. patcheng on Jan 26 2018, 12:02 AM. Authored by
Details
instead of static casting a MCExpr to MCSymbolRefExpr directly, use dyn_cast and added null check. Also removed an unnecessary (?) assertion
Diff Detail
Event Timeline
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 |
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?