1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 20:42:21 +02:00

Fixed while(false) loop

This commit is contained in:
Brian Fiete 2020-12-06 09:06:14 -08:00
parent 35c9cba898
commit 8d3b0d9e59
2 changed files with 17 additions and 1 deletions

View file

@ -5490,7 +5490,7 @@ void BfModule::Visit(BfWhileStatement* whileStmt)
// For BeefBackend we continue to do CondBr because it helps our flow analysis and we optimize it anyway
if ((isInfiniteLoop) && (!IsTargetingBeefBackend()))
mBfIRBuilder->CreateBr(bodyBB);
else if ((isFalseLoop) && (!IsTargetingBeefBackend()))
else if (isFalseLoop)
mBfIRBuilder->CreateBr(endBB);
else
mBfIRBuilder->CreateCondBr(checkVal.mValue, bodyBB, endBB);

View file

@ -0,0 +1,16 @@
using System;
namespace Tests
{
class Loops
{
[Test]
public static void TestBasics()
{
while (false)
{
}
}
}
}