[PATCH] D57834: [CodeExtractor] Only lift lifetime markers present in the extraction region

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 13 18:20:38 PST 2019


vsk added a comment.

@kachkov98 @davidxl apologies, but this patch is still not correct.

If a lifetime.end marker occurs along one path through the execution region, but not another, then it's still incorrect to lift the marker, because there is some path through the extracted function which would ordinarily not reach the marker. Example (extract blocks extract{1,2}):

  entry:
    lifetime_start(%slot)
    br label %header
  
  header:
    use(%slot)
    br i1 undef, label %extract1, label %extract2
  
  extract1:
    ; Backedge.
    br label %header 
  
  extract2:
    ; Lifting this marker would result in %slot being dead in the header block.
    lifetime_end(%slot)
    br label %exit

I think we have two options to fix this:

1. Do not lift any lifetime.end markers. Continue to lift lifetime.start markers for inputs, as this should still be safe.
2. Only lift a lifetime.end marker for an input if that marker would be reached in any every path through the extraction region. If an end marker can't be lifted, erase all lifetime markers for the input in the parent function to prevent bad stack slot merging.

Both options may cause some stack slot merging opportunities to go away. Wdyt?


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57834/new/

https://reviews.llvm.org/D57834





More information about the llvm-commits mailing list