45 TypeInModule computed_type;
46 switch (node->opcode()) {
47 case IrOpcode::kTypeGuard: {
48 if (!AllInputsTyped(node))
return NoChange();
50 if (!guarded_type.IsWasm())
return NoChange();
53 if (!input_type.IsWasm())
return NoChange();
54 TypeInModule guarded_wasm_type = guarded_type.AsWasm();
55 TypeInModule input_wasm_type = input_type.AsWasm();
62 case IrOpcode::kWasmTypeCast:
63 case IrOpcode::kWasmTypeCastAbstract: {
64 if (!AllInputsTyped(node))
return NoChange();
65 TypeInModule object_type =
71 object_type.type, to_type, object_type.module, object_type.module);
74 case IrOpcode::kAssertNotNull: {
75 if (!AllInputsTyped(node))
return NoChange();
76 TypeInModule object_type =
79 computed_type = {object_type.type.AsNonNull(), object_type.module};
82 case IrOpcode::kPhi: {
83 if (!AllInputsTyped(node)) {
97 node->id(), computed_type.type.name().c_str());
101 Type first_input_type =
103 if (!first_input_type.IsWasm())
return NoChange();
104 computed_type = first_input_type.AsWasm();
105 for (
int i = 1;
i < node->op()->ValueInputCount();
i++) {
108 if (!input_type.IsWasm())
return NoChange();
109 TypeInModule wasm_type = input_type.AsWasm();
110 if (computed_type.type.is_bottom()) {
112 computed_type = wasm_type;
113 }
else if (!wasm_type.type.is_bottom()) {
115 computed_type =
wasm::Union(computed_type, wasm_type);
119 "function: %d, phi node: %d, input#: %d, input0:%d:%s, input1:%d:%s, "
122 node->InputAt(0)->id(),
127 node->InputAt(1)->id(),
128 node->op()->ValueInputCount() > 1
134 computed_type.type.name().c_str());
137 case IrOpcode::kWasmArrayGet: {
144 if (object_type.type.is_uninhabited() ||
150 DCHECK(object_type.module->has_array(ref_index));
152 object_type.module->type(ref_index).array_type;
157 case IrOpcode::kWasmStructGet: {
163 if (object_type.type.is_uninhabited() ||
172 DCHECK(object_type.module->has_struct(ref_index));
175 object_type.module->type(ref_index).struct_type;
182 case IrOpcode::kNull: {
193 if (!(current_type.type.is_bottom() || computed_type.type.is_bottom() ||
195 current_type.module, computed_type.module) ||
197 computed_type.module, current_type.module) ||
200 computed_type.type.heap_representation() ==
203 "Error - Incompatible types. function: %d, node: %d:%s, input0:%d, "
204 "current %s, computed %s\n",
206 node->InputAt(0)->id(), current_type.type.name().c_str(),
207 computed_type.type.name().c_str());
211 current_type.module, computed_type.module)) {
217 node->id(), node->op()->mnemonic(),
221 computed_type.type.name().c_str());