瀏覽代碼

Fixed union equals method

Brian Fiete 3 年之前
父節點
當前提交
acf8b62f82
共有 1 個文件被更改,包括 3 次插入13 次删除
  1. 3 13
      IDEHelper/Compiler/BfModule.cpp

+ 3 - 13
IDEHelper/Compiler/BfModule.cpp

@@ -4950,19 +4950,6 @@ void BfModule::CreateValueTypeEqualsMethod(bool strictEquals)
 		auto _SizedIndex = [&](BfIRValue target, BfIRValue index)
 		auto _SizedIndex = [&](BfIRValue target, BfIRValue index)
 		{
 		{
 			BfTypedValue result;
 			BfTypedValue result;
-// 			if (sizedArrayType->mElementType->IsSizeAligned())
-// 			{
-// 				auto ptrType = CreatePointerType(sizedArrayType->mElementType);
-// 				auto ptrValue = mBfIRBuilder->CreateBitCast(target, mBfIRBuilder->MapType(ptrType));
-// 				auto gepResult = mBfIRBuilder->CreateInBoundsGEP(ptrValue, index);
-// 				result = BfTypedValue(gepResult, sizedArrayType->mElementType, BfTypedValueKind_Addr);
-// 			}
-// 			else
-// 			{
-// 				auto indexResult = CreateIndexedValue(sizedArrayType->mElementType, target, index);
-// 				result = BfTypedValue(indexResult, sizedArrayType->mElementType, BfTypedValueKind_Addr);
-// 			}
-
 			auto indexResult = CreateIndexedValue(sizedArrayType->mElementType, target, index, true);
 			auto indexResult = CreateIndexedValue(sizedArrayType->mElementType, target, index, true);
 			result = BfTypedValue(indexResult, sizedArrayType->mElementType, BfTypedValueKind_Addr);
 			result = BfTypedValue(indexResult, sizedArrayType->mElementType, BfTypedValueKind_Addr);
 
 
@@ -5117,8 +5104,11 @@ void BfModule::CreateValueTypeEqualsMethod(bool strictEquals)
 		{
 		{
 			BfExprEvaluator exprEvaluator(this);
 			BfExprEvaluator exprEvaluator(this);
 			BfTypedValue leftTypedVal = exprEvaluator.LoadLocal(mCurMethodState->mLocals[0]);
 			BfTypedValue leftTypedVal = exprEvaluator.LoadLocal(mCurMethodState->mLocals[0]);
+			leftTypedVal = AggregateSplat(leftTypedVal);
 			BfTypedValue leftUnionTypedVal = ExtractValue(leftTypedVal, NULL, 1);
 			BfTypedValue leftUnionTypedVal = ExtractValue(leftTypedVal, NULL, 1);
+
 			BfTypedValue rightTypedVal = exprEvaluator.LoadLocal(mCurMethodState->mLocals[1]);
 			BfTypedValue rightTypedVal = exprEvaluator.LoadLocal(mCurMethodState->mLocals[1]);
+			rightTypedVal = AggregateSplat(rightTypedVal);
 			BfTypedValue rightUnionTypedVal = ExtractValue(rightTypedVal, NULL, 1);
 			BfTypedValue rightUnionTypedVal = ExtractValue(rightTypedVal, NULL, 1);
 
 
 			EmitEquals(leftUnionTypedVal, rightUnionTypedVal, exitBB, strictEquals);
 			EmitEquals(leftUnionTypedVal, rightUnionTypedVal, exitBB, strictEquals);