[PATCH] D156657: [InstCombine] Fold icmp(constants[x]) when the range of x is given

Hongyu Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 1 10:11:44 PDT 2023


XChy updated this revision to Diff 546109.
XChy added a comment.

Already limit it to one variable. But I don't know why it is unlikely to be useful. From my perspective For multi-dimensional arrays, it's possible to have more than one index variable.

Besides, there exists miscompilation, I found just now.  Current state-machine doesn't emit the CmpInst/Poison to guarrantee the index/offset is always not negative. Lack of such range-check would lead to something triggering UB not to doing so. I need to check it later.


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

https://reviews.llvm.org/D156657

Files:
  llvm/include/llvm/Transforms/InstCombine/InstCombiner.h
  llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
  llvm/test/Transforms/InstCombine/load-cmp.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156657.546109.patch
Type: text/x-patch
Size: 20340 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230801/0af93b11/attachment.bin>


More information about the llvm-commits mailing list