From acf8b62f82e0baff8337d82a5f4867939f4dde49 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Wed, 1 Jun 2022 11:26:01 -0700 Subject: [PATCH] Fixed union equals method --- IDEHelper/Compiler/BfModule.cpp | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/IDEHelper/Compiler/BfModule.cpp b/IDEHelper/Compiler/BfModule.cpp index 0bfa3095..c7ecb2d7 100644 --- a/IDEHelper/Compiler/BfModule.cpp +++ b/IDEHelper/Compiler/BfModule.cpp @@ -4950,19 +4950,6 @@ void BfModule::CreateValueTypeEqualsMethod(bool strictEquals) auto _SizedIndex = [&](BfIRValue target, BfIRValue index) { 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); result = BfTypedValue(indexResult, sizedArrayType->mElementType, BfTypedValueKind_Addr); @@ -5117,8 +5104,11 @@ void BfModule::CreateValueTypeEqualsMethod(bool strictEquals) { BfExprEvaluator exprEvaluator(this); BfTypedValue leftTypedVal = exprEvaluator.LoadLocal(mCurMethodState->mLocals[0]); + leftTypedVal = AggregateSplat(leftTypedVal); BfTypedValue leftUnionTypedVal = ExtractValue(leftTypedVal, NULL, 1); + BfTypedValue rightTypedVal = exprEvaluator.LoadLocal(mCurMethodState->mLocals[1]); + rightTypedVal = AggregateSplat(rightTypedVal); BfTypedValue rightUnionTypedVal = ExtractValue(rightTypedVal, NULL, 1); EmitEquals(leftUnionTypedVal, rightUnionTypedVal, exitBB, strictEquals);