Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BOLT] Fix handling of RememberState CFI
Summary: When RememberState CFI happens to be the last CFI in a basic block, we used to set the state of the next basic block to a CFI prior to executing RememberState instruction. This contradicts comments in annotateCFIState() function and also differs form behaviour of getCFIStateAtInstr(). As a result we were getting code like the following: .LBB0121166 (21 instructions, align : 1) CFI State : 0 .... 0000001a: !CFI $1 ; OpOffset Reg6 -16 0000001a: !CFI $2 ; OpRememberState .... Successors: .Ltmp4167600, .Ltmp4167601 CFI State: 3 .Ltmp4167601 (13 instructions, align : 1) CFI State : 2 .... Notice that the state at the entry of the 2nd basic block is less than the state at the exit of the previous basic block. In practice we have never seen basic blocks where RememberState was the last CFI instruction in the basic block, and hence we've never run into this issue before. The fix is a synchronization of handling of last RememberState instruction by annotateCFIState() and getCFIStateAtInstr(). In the example above, the CFI state at the entry to the second BB will be 3 after this diff. (cherry picked from FBD6314916)
- Loading branch information