Summary: ## Problem In method specialization, we don't translate the loads of specialized blocks (e.g. `n$0 = block:_fn_`) and only add them to the id map. Later on, when the block is called with arguments (`n$0(arg1,..argn))` we lookup the id and use the substitution for the block. However, this means, if the program uses the id loading the block (n$0) anywhere else in the program, we have no declaration for it. ## When does this happen? For blocks that return a nullable result, objC programs usually do a null check as in the following example: ``` typedef id _Nullable (^BlockType)(id object); + (void)useBlock:(int) x myBlock:(BlockType)myBlock{ if (myBlock){ myBlock(x); } } + (void)callUseBlock{ [X useBlock 1 myBlock:^id(id object) { return nil; }]; } ``` Here, method specialization currently ignores the loads of this block (`n$0=*&myBlock:_fn_(*)`) which results in having variables in prune nodes that are not defined anywhere in the CFG (like `n$0`). This confuses control variable analysis when the conditional is wrapped in a loop because it cannot lookup where `n$0` is coming from. ## Fix This diff fixes the issue by translating the loading of the blocks. Reviewed By: dulmarod Differential Revision: D21642924 fbshipit-source-id: 2bc0442ffmaster
parent
7abc631c71
commit
7b75ee7f5a
Loading…
Reference in new issue