<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 10/13/20 9:35 AM, Atmn Patel via
      llvm-dev wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAAGuk=zp7RZ3_pPLhBmNKNmXwQNq015K2oCJ1gj3JnuwFf3AHA@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr"><font size="2"><span
            style="font-family:arial,sans-serif">Hi All,<br>
            <br>
            We've prepared a new attribute `maxobjsize(<n>)` that
            tracks the maximum size of the object that a pointer points
            to. This attribute will be deduced through the Attributor
            framework and it is used for aliasing queries. The
            `maxobjsize` of an object, and number of `dereferenceable`
            bytes can be used as upper and lower bounds on the object
            size, and if there is no overlap, we can determine that the
            underlying objects cannot alias. Basically, an object that
            is at most N bytes long is not aliasing one that is at least
            N+1 bytes long.<br>
          </span></font></div>
    </blockquote>
    <p><font size="2">This is commingling two separate concerns.  At
        minimum, a wording clarification is needed, it's possible the
        proposed use case does not work.</font></p>
    <p><font size="2">Deferenceability is the amount of space which can
        be accessed without a runtime fault.  Of key importance is the
        dereferenceability is disconnected from object size.  There may
        be space beyond an object which is dereferenceable, but outside
        the object.</font></p>
    <p><font size="2">As a simple example, imagine an allocator which
        allocates 32 byte blocks of memory, 32 byte aligned.  If the
        actual object allocated is only 16 bytes, the pointer is still
        known to be 32 byte aligned and deref for 32 bytes.  The
        contents past the object are simply unspecified.  <br>
      </font></p>
    <p><font size="2">Saying that a 32 byte derefenceable pointer
        doesn't alias one with a maximum object size of 16 bytes would
        be wrong and lead to miscompiles in practice.  <br>
      </font></p>
    <p><font size="2"><br>
      </font></p>
    <blockquote type="cite"
cite="mid:CAAGuk=zp7RZ3_pPLhBmNKNmXwQNq015K2oCJ1gj3JnuwFf3AHA@mail.gmail.com">
      <div dir="ltr"><font size="2"><span
            style="font-family:arial,sans-serif"><br>
            These changes are in:<br>
            - D87975 - [IR] Introduce MaxObjSize Attribute<br>
            - D87978 - [Attributor] Adds deduction for the MaxObjSize
            Attribute<br>
            - D88353 - [BasicAA] Integrate MaxobjSize for NoAlias<br>
            <br>
            These are the Statistics changes for CTMark *without* the
            actual deduction (<a
              href="https://reviews.llvm.org/D88353#2301597"
              moz-do-not-send="true">https://reviews.llvm.org/D88353#2301597</a>):<br>
            CHANGED: branch-folder                NumHoist              
                                           438 ->        431 (  
             -1.598%)<br>
            CHANGED: codegenprepare               NumBlocksElim        
                                          16093 ->      15885 (  
             -1.292%)<br>
            CHANGED: codegenprepare               NumExtsMoved          
                                          6373 ->       6439 (  
             +1.036%)<br>
            CHANGED: gvn                        
             IsValueFullyAvailableInBlockNumSpeculationsMax       6746
            ->       6858 (    +1.660%)<br>
            CHANGED: gvn                          NumGVNInstr          
                                          78434 ->      79330 (  
             +1.142%)<br>
            CHANGED: instcombine                  NumReassoc            
                                         22830 ->      23213 (  
             +1.678%)<br>
            CHANGED: instsimplify                 NumSimplified        
                                          21278 ->      21495 (  
             +1.020%)<br>
            CHANGED: licm                         NumPromoted          
                                            407 ->        497 (  
            +22.113%)<br>
            CHANGED: loop-rotate                
             NumNotRotatedDueToHeaderSize                           37
            ->         35 (    -5.405%)<br>
            CHANGED: loop-simplify                NumNested            
                                            126 ->        128 (  
             +1.587%)<br>
            CHANGED: machinelicm                  NumPostRAHoisted      
                                           131 ->        134 (  
             +2.290%)<br>
            CHANGED: memory-builtins              ObjectVisitorLoad    
                                          96077 ->      97496 (  
             +1.477%)<br>
            CHANGED: regalloc                     NumDCEFoldedLoads    
                                             38 ->         37 (  
             -2.632%)<br>
            CHANGED: regalloc                     NumLaneConflicts      
                                          4408 ->       4332 (  
             -1.724%)<br>
            CHANGED: regalloc                     NumReloadsRemoved    
                                           1062 ->       1050 (  
             -1.130%)<br>
            CHANGED: regalloc                     NumSnippets          
                                           1168 ->       1152 (  
             -1.370%)<br>
            CHANGED: regalloc                     NumSpillsRemoved      
                                           672 ->        665 (  
             -1.042%)<br>
            CHANGED: stack-slot-coloring          NumDead              
                                             14 ->         18 (  
            +28.571%)<br>
            CHANGED: twoaddressinstruction        NumConvertedTo3Addr  
                                          27054 ->      26695 (  
             -1.327%)<br>
            <br>
            These are the Statistic Changes in CTMark w/O3 before/after
            these patches (<a
              href="https://reviews.llvm.org/D87978#2307622"
              moz-do-not-send="true">https://reviews.llvm.org/D87978#2307622</a>):<br>
            CHANGED: codegenprepare               NumExtsMoved          
                                          3631 ->       3699 (  
             +1.873%)<br>
            CHANGED: dse                          NumFastOther          
                                           192 ->        194 (  
             +1.042%)<br>
            CHANGED: gvn                        
             IsValueFullyAvailableInBlockNumSpeculationsMax       4958
            ->       5060 (    +2.057%)<br>
            CHANGED: gvn                          NumGVNInstr          
                                          46657 ->      47534 (  
             +1.880%)<br>
            CHANGED: jump-threading               NumDupes              
                                            91 ->         92 (  
             +1.099%)<br>
            CHANGED: licm                         NumMovedLoads        
                                           6272 ->       6344 (  
             +1.148%)<br>
            CHANGED: licm                         NumPromoted          
                                            381 ->        438 (  
            +14.961%)<br>
            CHANGED: loop-rotate                
             NumNotRotatedDueToHeaderSize                           31
            ->         29 (    -6.452%)<br>
            CHANGED: machinelicm                  NumPostRAHoisted      
                                            88 ->         89 (  
             +1.136%)<br>
            CHANGED: memdep                       NumCacheNonLocalPtr  
                                        1005887 ->    1016671 (  
             +1.072%)<br>
            CHANGED: memory-builtins              ObjectVisitorLoad    
                                          62048 ->      63473 (  
             +2.297%)<br>
            CHANGED: peephole-opt                 NumCmps              
                                            532 ->        526 (  
             -1.128%)<br>
            CHANGED: regalloc                     NumDCEFoldedLoads    
                                             27 ->         26 (  
             -3.704%)<br>
            CHANGED: regalloc                     NumLocalSplits        
                                          1891 ->       1870 (  
             -1.111%)<br>
            <br>
            Feedback Welcome.<br>
            <br>
            Atmn and Johannes</span></font></div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
    </blockquote>
  </body>
</html>