[PATCH] D117365: [InstCombine] optimize icmp-ugt-ashr
    Nadav Rotem via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Jan 19 07:48:43 PST 2022
    
    
  
nadav added a comment.
@craig.topper Thank you for the review, and for writing the proof, of course. This is my understanding of the code and of your proof.
Your proof has two checks, which I added as comments.
  ;Assume: C + 1 == ((C+1 << y) >> y)
  ;Assume ((c +1 ) << y) != 127      -- only needed for the sgt case
   
The first check is implemented with the code:
  APInt ShiftedC = (C + 1).shl(ShAmtVal) - 1;
  if ((ShiftedC + 1).ashr(ShAmtVal) == (C + 1))
And the second one with:
  !C.isMaxSignedValue() && (ShiftedC + 1).ashr(ShAmtVal) == (C + 1)
The code also has this check, which I removed, because the proof does not have this check:
  !(C + 1).shl(ShAmtVal).isMinSignedValue()
Is this also your understanding, or did I miss something.
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117365/new/
https://reviews.llvm.org/D117365
    
    
More information about the llvm-commits
mailing list