[llvm-commits] [llvm] r76215 - /llvm/trunk/include/llvm/Value.h

Dan Gohman gohman at apple.com
Sat Jul 18 07:38:28 PDT 2009


On Jul 17, 2009, at 5:52 PM, Daniel Dunbar wrote:

> Hi Dan,
>
> On Fri, Jul 17, 2009 at 11:56 AM, Dan Gohman<gohman at apple.com> wrote:
>> +  /// clearOptionalData - Clear any optional optimization data  
>> from this Value.
>> +  /// Transformation passes must call this method whenever  
>> changing the IR
>> +  /// in a way that would affect the values produced by this  
>> Value, unless
>> +  /// it takes special care to ensure correctness in some other way.
>
> What does this mean? It isn't clear if the optional data is based on
> the structure of the Value, or the semantics of the Value. If I change
> the operand of an add, do I have to clear it? If I change the the
> operand of an add, do I have to clear the flag for all users of the
> add (which would mean I have to do a full walk of the use graph).


If you change an operand of an add in a way that would cause the
add to produce different values at runtime, then yes.  And yes, walking
the def-use graph could be necessary in extreme cases.

This optional data is information like "signed overflow is undefined".
For example, in this C code:

   int foo(int x, int y) {
     return x+y;
   }

C front-ends may set the no-signed-overflow bit on the add, since
the C language guarantees that.  If a transformation changes this
code to give the add operands which may have different values,
it may cause the add to overflow in cases where it previously didn't.

Dan




More information about the llvm-commits mailing list