Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHI insetion in the TAC representation. #18

Open
XiaowenHu96 opened this issue Jul 12, 2021 · 0 comments
Open

PHI insetion in the TAC representation. #18

XiaowenHu96 opened this issue Jul 12, 2021 · 0 comments

Comments

@XiaowenHu96
Copy link

I tried to perform some kind of out-of-SSA translation on the output TAC representation.
I found some of the PHI operations seem to be ill-formed.

Take long_running.hex as an example, in the TAC output, the function function getTransactionCount(bool,bool)() public contains a block:

    Begin block 0x73aB0x210
    prev=[0x739B0x210], succ=[0x740B0x210, 0x746B0x210]
    =================================
    0x73a_0x00x210: v73a_0V210 = PHI v218, v21d, v714V210, v738V210
    0x73b0x210: v73bV210 = ISZERO v73a_0V210
    0x73c0x210: v73cV210(0x746) = CONST 
    0x73f0x210: JUMPI v73cV210(0x746), v73bV210

Here, PHI takes four possible variables but has only one predecessor. This already confuses me as it is not at a join node (which means it can't be a dominance frontier). But let's move on and look at its predecessor, which is an empty block with three incoming edges.

    Begin block 0x739B0x210
    prev=[0x715B0x210, 0x71bB0x210, 0x723B0x210], succ=[0x73aB0x210]
    =================================

I have no clue of why this block is empty, but given three incoming edges, there is no enough information to decode the PHI operation.

The strongest evidence shows that there is something wrong with the PHI insertion is that two of the variables in the PHI operation v218, v21d are actually defined in the same block:

    Begin block 0x210
    prev=[0x205], succ=[0x6e8B0x210]
    =================================
    0x211: v211(0x14d) = CONST 
    0x214: v214(0x4) = CONST 
    0x216: v216 = CALLDATALOAD v214(0x4)
    0x217: v217 = ISZERO v216
    0x218: v218 = ISZERO v217
    0x219: v219(0x24) = CONST 
    0x21b: v21b = CALLDATALOAD v219(0x24)
    0x21c: v21c = ISZERO v21b
    0x21d: v21d = ISZERO v21c
    0x21e: v21e(0x6e8) = CONST 
    0x221: JUMP v21e(0x6e8)

Any help would be appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant