[PATCH] D109883: [Analysis] Add support for vscale in computeKnownBitsFromOperator

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 20 03:23:22 PDT 2021


foad added inline comments.


================
Comment at: llvm/include/llvm/Support/KnownBits.h:291
+  // Same as above, but with a uint64_t argument.
+  static KnownBits makeConstant(uint64_t C) { return makeConstant(C); }
+
----------------
david-arm wrote:
> david-arm wrote:
> > foad wrote:
> > > I'm confused. How does this work (since there is no implicit conversion from uint64_t to APInt) and what does it do (i.e. what BitWidth does it use)?
> > Hi @foad, oh I see. I should probably write
> > 
> >   return makeConstant(APInt(C));
> > 
> > instead. I imagine the compiler has just assumed I'm calling the version that takes an APInt!
> Hi @foad, I just wonder if it's really worth adding this overloaded version as you were suggesting in a comment last week? Having looked into this again I realise I probably do need to pass in the BitWidth as well and I'm not sure how commonly this function would be called? I'd also have to deal with a possible mis-match in bitwidths, i.e. if we request a bit width of 32 but the constant has more than 32 bits?
Sure, it was just a half-baked idea, I hadn't really thought through the details. It definitely wouldn't need to be part of this patch anway.


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

https://reviews.llvm.org/D109883



More information about the llvm-commits mailing list