[llvm-commits] patch: teach dse about intrinsics

Chris Lattner clattner at apple.com
Tue Oct 20 22:51:14 PDT 2009


On Oct 17, 2009, at 10:14 PM, Nick Lewycky wrote:

> Nick Lewycky wrote:
>> This patch creates a utility class like an Operator (GEPOperator  
>> and friends) which represents instructions that clobber a pointer  
>> they're given. This groups StoreInst together with certain  
>> intrinsics and helps DSE handle them as a group.
>> This also marks our first optimization based on @llvm.lifetime.end.
>> Please review!
>
> Arr... minor bug. This had code:
>
>      // Because a memcpy or memmove is also a load, we can't skip it  
> if we
>      // didn't remove it.
>      if (isa<MemTransferInst>(C))
>        continue;
>
> the change to use isa<MemTransferInst>(C) was a late change, after I  
> had run the nightly. (Previously I had a C->read() method but that's  
> the same as testing for MemTransferInst.) The correct code negates  
> the test:
>
>      // Because a memcpy or memmove is also a load, we can't skip it  
> if we
>      // didn't remove it.
>      if (!isa<MemTransferInst>(C))
>        continue;
>
> and since I know what you really want is a full patch, the updated  
> patch is attached.

Hi Nick,

This is two changes: 1) to add ClobberingInst, and 2) use it to do new  
stuff.  Because the two are conflated together into two patches, it  
makes it harder to review either.

Because #2 is hidden in noise, I'll address #1 first: why is a new  
pseudo instruction class like this the right way to go?  Why not add a  
simple static helper function instead?

-Chris



More information about the llvm-commits mailing list