Fix constant pointer if conditions

This commit is contained in:
drmortalwombat 2024-09-21 14:38:35 +02:00
parent a04b09c737
commit 925ee9d8f3

View File

@ -14816,7 +14816,19 @@ InterCodeBasicBlock* InterCodeBasicBlock::CheckIsConstBranch(const GrowingInstru
if (k < tins.Size() && tins[k]->mCode == IC_CONSTANT) if (k < tins.Size() && tins[k]->mCode == IC_CONSTANT)
{ {
InterCodeBasicBlock* tblock = tins[k]->mConst.mIntConst ? mTrueJump : mFalseJump; InterInstruction* cins = tins[k];
bool istrue = false;
InterType it = cins->mDst.mType;
if (it == IT_FLOAT)
istrue = cins->mConst.mFloatConst != 0;
else if (it == IT_POINTER)
istrue = cins->mConst.mMemory != IM_ABSOLUTE || cins->mConst.mIntConst != 0;
else
istrue = cins->mConst.mIntConst != 0;
InterCodeBasicBlock* tblock = istrue ? mTrueJump : mFalseJump;
InterCodeBasicBlock* xblock = this->Clone(); InterCodeBasicBlock* xblock = this->Clone();
InterInstruction* bins = xblock->mInstructions.Pop(); InterInstruction* bins = xblock->mInstructions.Pop();