Closed doste closed 5 months ago
Hmm there are a lot of tests broken. Not clear to me if related to this PR.
DRProductionBytecodeTest
✗ #testBytecodeExtendedUnconditionalJump (843ms)
✗ #testBytecodeExtendedUnconditionalJumpBackward (852ms)
✗ #testBytecodeShortJumpIfFalseWithFalse (47ms)
✗ #testBytecodeShortJumpIfFalseWithNil (52ms)
✗ #testBytecodeShortJumpIfFalseWithTrue (44ms)
✗ #testBytecodeShortJumpIfTrueWithFalse (56ms)
✗ #testBytecodeShortJumpIfTrueWithFalseNotMustBeBoolean (46ms)
✗ #testBytecodeShortJumpIfTrueWithNil (56ms)
✗ #testBytecodeShortJumpIfTrueWithTrue (46ms)
✗ #testBytecodeShortJumpIfTrueWithTrueNotMustBeBoolean (60ms)
✗ #testBytecodeShortUnconditionalJump (130ms)
✗ #testBytecodeExtendedUnconditionalJump (945ms)
✗ #testBytecodeExtendedUnconditionalJumpBackward (853ms)
✗ #testBytecodeShortJumpIfFalseWithFalse (52ms)
✗ #testBytecodeShortJumpIfFalseWithNil (154ms)
✗ #testBytecodeShortJumpIfFalseWithTrue (49ms)
✗ #testBytecodeShortJumpIfTrueWithFalse (51ms)
✗ #testBytecodeShortJumpIfTrueWithFalseNotMustBeBoolean (51ms)
✗ #testBytecodeShortJumpIfTrueWithNil (55ms)
✗ #testBytecodeShortJumpIfTrueWithTrue (52ms)
✗ #testBytecodeShortJumpIfTrueWithTrueNotMustBeBoolean (54ms)
✗ #testBytecodeShortUnconditionalJump (36ms)
DRPrimitiveScenarioCompilationTest
✗ #testAdditionIntrinsecWithOverflow (34ms)
✗ #testWhileTrue (10005ms)
✗ #testWhileTrueWithGlobalState (10001ms)
✗ #testAdditionIntrinsecWithOverflow (127ms)
✗ #testWhileTrue (10001ms)
✗ #testWhileTrueWithGlobalState (10002ms)
✗ #testAdditionIntrinsecWithOverflow (39ms)
✗ #testImplicitBitShiftLeft (143ms)
✗ #testImplicitBitShiftRight (44ms)
✗ #testImplicitConstantArgumentBitShiftLeft (45ms)
✗ #testLogicalBitShiftRight (33ms)
✗ #testWhileTrue (10001ms)
✗ #testWhileTrueWithGlobalState (10002ms)
✗ #testAdditionIntrinsecWithOverflow (38ms)
✗ #testImplicitBitShiftLeft (41ms)
✗ #testImplicitBitShiftRight (44ms)
✗ #testImplicitConstantArgumentBitShiftLeft (43ms)
✗ #testLogicalBitShiftRight (31ms)
✗ #testWhileTrue (10002ms)
✗ #testWhileTrueWithGlobalState (10001ms)
DRProductionPrimitiveCompilationTest
✗ #testCompilePrimitiveAtOnNonArray (6582ms)
✗ #testCompilePrimitiveAt (6283ms)
✗ #testCompilePrimitiveAtByteArray (6572ms)
✗ #testCompilePrimitiveAtManyElements (6527ms)
✗ #testCompilePrimitiveWithArgNewInitializesArray (3986ms)
✗ #testCompilePrimitiveWithArgNewInitializesByteArray (3767ms)
✗ #testCompilePrimitiveWithArgNewInitializesInteger16Array (3874ms)
✗ #testCompilePrimitiveWithArgNewInitializesInteger32Array (3981ms)
✗ #testCompilePrimitiveWithArgNewInitializesInteger64Array (3772ms)
✗ #testCompilePrimitiveWithArgNewInstantiatesArray (3919ms)
✗ #testCompilePrimitiveWithArgNewInstantiatesByteArray (3796ms)
✗ #testCompilePrimitiveWithArgNewInstantiatesInteger16Array (3963ms)
✗ #testCompilePrimitiveWithArgNewInstantiatesInteger32Array (3889ms)
✗ #testCompilePrimitiveWithArgNewInstantiatesInteger64Array (3793ms)
✗ #testCompilePrimitiveAtOnNonArray (6184ms)
✗ #testPrimitiveValuePushReceiver (261ms)
✗ #testCompilePrimitiveAt (6179ms)
✗ #testCompilePrimitiveAtByteArray (6513ms)
✗ #testCompilePrimitiveAtManyElements (6285ms)
✗ #testCompilePrimitiveWithArgNewInitializesArray (4020ms)
✗ #testCompilePrimitiveWithArgNewInitializesByteArray (3836ms)
✗ #testCompilePrimitiveWithArgNewInitializesInteger16Array (3887ms)
✗ #testCompilePrimitiveWithArgNewInitializesInteger32Array (3877ms)
✗ #testCompilePrimitiveWithArgNewInitializesInteger64Array (3759ms)
✗ #testCompilePrimitiveWithArgNewInstantiatesArray (3709ms)
✗ #testCompilePrimitiveWithArgNewInstantiatesByteArray (3853ms)
✗ #testCompilePrimitiveWithArgNewInstantiatesInteger16Array (3957ms)
✗ #testCompilePrimitiveWithArgNewInstantiatesInteger32Array (3892ms)
✗ #testCompilePrimitiveWithArgNewInstantiatesInteger64Array (3842ms)
✗ #testPrimitiveValuePushReceiver (262ms)
DRLoopInvariantCodeMotionTest
✗ #testLoopInvariantCodeMotionAdjustsPhiFunctionsOfMovedInstruction (14ms)
✗ #testLoopInvariantCodeMotionMovesConstantInstructionOutsideOfLoop (5ms)
✗ #testLoopInvariantCodeMotionMovesMultipleRelatedInstructionsOutsideOfLoop (7ms)
✗ #testLoopInvariantCodeMotionWorksWithLoopsWithMultipleBodyBlocks (5ms)
✗ #testLoopInvariantCodeMotionWrapsMovedInstructionWithIf (7ms)
DRCogitCanonicaliserTest
✗ #testSimplifyBranchIfCondition (6ms)
@doste could you check if those tests get fixed if you comment your code in the canonicaliser?
Added a visitPhiFunction method in the DRCogitCanonicaliser which checks if one of the operands of the Phi is constant and if so, then checks if this Phi is used as a parameter of a comparison, if so we tail duplicate this Phi so the constant then can be optimized by another optimization such as the ConstantFolding.
Actually we don't specifically tail duplicate it, but 'split to'. This is because the block containing the Phi may have a bunch of predecessors so if we tail duplicate it directly we might end up with a lot of blocks, each corresponding one predecessor. Instead, by 'splitting to' we only end up with one more block. Here is a little example:
[a, b, c and d are BasicBlock's and a1, b1, c1 and d1 are the Phi operands corresponding to each respective block] [In this example the operand d1 is a constant, so we splitTo the block containing it]