[PATCH] D145929: [LSR] Fold terminating condition not only for eq and ne

EverRest via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 15 01:22:12 PDT 2023


MarkGoncharovAl updated this revision to Diff 505390.
MarkGoncharovAl added a comment.

Thank you for review!

1. I disabled checking for poison value.

*dyn_cast to poison* / use *isGuaranteedNotToBeUndefOrPoison* / use *containsUndefOrPoisonElement* are not correct way to check.

Please, offer your solution how to process it - so, I will not add it to this patch.

2. @nikic , thank you for finding my mistake.

I added 4 tests. The solution is to process using one scheme:

  %cmp = icmp eq ptr %iv, %iv_end
  br i1 %cmp, label %for.end, label %for.body

We create *iv_end* using **SE.getBackedgeTakenCount**, thus when we get *iv* equals to *iv_end* then we have to jump to if.end. Finally, we have to be confident that the first successors is equal to LoopLatch.


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

https://reviews.llvm.org/D145929

Files:
  llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
  llvm/test/Transforms/LoopStrengthReduce/lsr-term-fold-negative-testcase.ll
  llvm/test/Transforms/LoopStrengthReduce/lsr-term-fold.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145929.505390.patch
Type: text/x-patch
Size: 8340 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230315/fcd6a34e/attachment.bin>


More information about the llvm-commits mailing list