[PATCH] D86578: [TargetLowering] Combine known bits for icmp in SimplifySetCC - https://bugs.llvm.org/ show_bug.cgi?id=41182

Matt D'Arcangelo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 15:51:15 PDT 2020


darcangelo.matthew created this revision.
darcangelo.matthew added reviewers: RKSimon, spatel.
Herald added subscribers: llvm-commits, steven.zhang, hiraditya.
Herald added a project: LLVM.
darcangelo.matthew requested review of this revision.

Early review for folding integer comparisons where the known bits of the operands allows the result to be determined - still have some regressions to address

1. Changes in TargetLowering.SimplifySetCC handle each integer comparison, added X86 tests combine-known-bits*.ll
2. Added two APIs to KnownBits to handle the signed min/max values
3. Folded constant bool branches and updated CFG in DAGCombiner.visitBRCOND
4. Added API to the SelectionDAG to retrieve the current MachineBasicBlock
5. Updated test-shrink.ll as a sample for how to move forward on updating the additional tests

I am not sure how best to deal with (3) and (4), and if there is somewhere else that updating the CFG should take place, or if there is another way to get the current MBB. I do think this is the right place to collapse the branches, but please let me know if that's not the case.

For (5), this test is an example of failures that I've been hitting because the result of one of the instructions can be determined from the known bits. I plan to update these by making the result indeterminable for each case, but wanted to know if this is the right direction.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86578

Files:
  llvm/include/llvm/CodeGen/SelectionDAG.h
  llvm/include/llvm/Support/KnownBits.h
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
  llvm/test/CodeGen/X86/combine-known-bits-vector.ll
  llvm/test/CodeGen/X86/combine-known-bits.ll
  llvm/test/CodeGen/X86/test-shrink.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86578.287789.patch
Type: text/x-patch
Size: 25317 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200825/6b1828a7/attachment.bin>


More information about the llvm-commits mailing list