@@ -173,9 +173,9 @@ struct ValidationInfo {
173173 return true ;
174174 }
175175
176- template <typename T, typename S >
176+ template <typename T>
177177 bool shouldBeEqualOrFirstIsUnreachable (
178- S left, S right, T curr, const char * text, Function* func = nullptr ) {
178+ Type left, Type right, T curr, const char * text, Function* func = nullptr ) {
179179 if (left != Type::unreachable && left != right) {
180180 std::ostringstream ss;
181181 ss << left << " != " << right << " : " << text;
@@ -608,9 +608,9 @@ struct FunctionValidator : public WalkerPass<PostWalker<FunctionValidator>> {
608608 return info.shouldBeEqual (left, right, curr, text, getFunction ());
609609 }
610610
611- template <typename T, typename S >
611+ template <typename T>
612612 bool
613- shouldBeEqualOrFirstIsUnreachable (S left, S right, T curr, const char * text) {
613+ shouldBeEqualOrFirstIsUnreachable (Type left, Type right, T curr, const char * text) {
614614 return info.shouldBeEqualOrFirstIsUnreachable (
615615 left, right, curr, text, getFunction ());
616616 }
@@ -2443,19 +2443,16 @@ void FunctionValidator::visitSelect(Select* curr) {
24432443}
24442444
24452445void FunctionValidator::visitWideIntAddSub (WideIntAddSub* curr) {
2446- if (! shouldBeTrue (getModule ()->features .hasWideArithmetic (),
2446+ shouldBeTrue (getModule ()->features .hasWideArithmetic (),
24472447 curr,
2448- " Wide arithmetic is not enabled" )) {
2449- return ;
2450- }
2448+ " i64.add128 / i64.sub128 require wide arithmetic [--enable-wide-arithmetic]" );
2449+
24512450 for (auto * operand :
24522451 {curr->leftLow , curr->leftHigh , curr->rightLow , curr->rightHigh }) {
2453- if (operand->type != Type::unreachable) {
2454- shouldBeEqual (operand->type ,
2455- Type (Type::i64 ),
2456- curr,
2457- " wide binary child types must be i64" );
2458- }
2452+ shouldBeEqualOrFirstIsUnreachable (operand->type ,
2453+ Type (Type::BasicType::i64 ),
2454+ curr,
2455+ " wide binary child types must be i64" );
24592456 }
24602457}
24612458
0 commit comments