[PATCH] D31846: [coroutines] Handle spills before catchswitch

Gor Nishanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 10 11:07:05 PDT 2017


GorNishanov created this revision.
Herald added a subscriber: EricWF.

If we need to spill the result of the PHI instruction, we insert the spill after
all of the PHIs and EHPads, however, in a catchswitch block there is no 
room to insert the spill. Make room by splitting away PHIs into a separate
block.

Before the fix:

  catch.dispatch:
    %val = phi i32 [ 1, %if.then ], [ 2, %if.else ]
    %switch = catchswitch within none [label %catch] unwind label %cleanuppad

After:

  catch.dispatch:
    %val = phi i32 [ 1, %if.then ], [ 2, %if.else ]
    %tok = cleanuppad within none []
    ; spill goes here
   cleanupret from %tok unwind label %catch.dispatch.switch
  catch.dispatch.switch:
    %switch = catchswitch within none [label %catch] unwind label %cleanuppad




https://reviews.llvm.org/D31846

Files:
  lib/Transforms/Coroutines/CoroFrame.cpp
  test/Transforms/Coroutines/coro-catchswitch.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31846.94596.patch
Type: text/x-patch
Size: 5251 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170410/6d7a3f86/attachment.bin>


More information about the llvm-commits mailing list