[llvm-commits] [llvm] r158951 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombineCalls.cpp test/Transforms/InstCombine/invoke.ll

Nuno Lopes nunoplopes at sapo.pt
Fri Jun 22 10:22:43 PDT 2012


>>>> instcombine: disable optimization of 'invoke null/undef'. I'll move this
>>>> functionality to SimplifyCFG (since we cannot make changes to the  
>>>> CFG here).
>>>> Fixes the crashes with the attached test case
>>>
>>> can you just set "nounwind" on the invoke? (Not sure if that is possible -
>>> maybe for an invoke it can only be done on the callee?). Then some other
>>> pass will magically take care of it.
>>
>> Actually that code was doing a bit more than removing the invoke. It was
>> inserting an undefined operation before 'invoke null/undef' so that  
>> the simplify
>> CFG pass could then replace the invoke with unreachable. My idea was to move
>> this logic (invoke null -> unreachable) into simplify CFG. Sounds  
>> reasonable?
>
> yes, that sounds reasonable.  You can still cheat (mark it nounwind in
> instcombine, and implement "call null" -> unreachable, which maybe is done
> already) but it's maybe clearer and no harder to do it directly.

All right, so can you please take a look to the attached patch? It  
makes the following changes:
  - simplifycfg:  invoke undef/null -> unreachable
  - instcombine:  invoke new  -> invoke expect(0, 0)  (an arbitrary  
NOOP intrinsic;  only done if the allocated memory is unused, of course)
  - verifier:  allow invoke of intrinsics  (to make the previous step work)

Thanks,
Nuno
-------------- next part --------------
A non-text attachment was scrubbed...
Name: invoke.patch
Type: text/x-patch
Size: 4306 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120622/0be6b6b5/attachment.bin>


More information about the llvm-commits mailing list