[PATCH] D138082: GlobalISel: ComputeNumSignBits from load range metadata

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 15 23:09:56 PST 2022


foad added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp:609
 
+static unsigned computeNumSignBitsFromRangeMetadata(const GAnyLoad *Ld,
+                                                    unsigned TyBits) {
----------------
Needs a comment, and possibly a better name, since this is not just looking at the range metadata, it is also handling different kinds of load opcode.


================
Comment at: llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp:630
+  if (TyBits != CR.getBitWidth())
+    return 1;
+
----------------
How could we hit this?


================
Comment at: llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp:722
     const MachineMemOperand *MMO = *MI.memoperands_begin();
     return TyBits - MMO->getSizeInBits();
   }
----------------
arsenm wrote:
> Probably should still factor this in 
If you can rely on `MMO->getSizeInBits() == CR.getBitWidth()` then computeNumSignBitsFromRangeMetadata has already done this.


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

https://reviews.llvm.org/D138082



More information about the llvm-commits mailing list