[PATCH] D120083: [instsimplify] Generalize offset handling when compare pointers derived from allocas
    Nikita Popov via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Thu Feb 17 13:33:57 PST 2022
    
    
  
nikic added a comment.
> I vaguely think there should be a more concise way to write these checks. Anyone see one?
As we're dealing with equality comparisons here, we can subtract a common offset from both sides. So rather than dealing with `LHS + LHSOffset == RHS + RHSOffset`, we can instead deal with `LHS + Offset == RHS`, where `Offset = LHSOffset - RHSOffset`. We should be able to fold that if and only if `Offset > -MinSize(RHS)` and `Offset < MinSize(LHS)`.
Does that sound about right?
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120083/new/
https://reviews.llvm.org/D120083
    
    
More information about the llvm-commits
mailing list