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

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 20 03:13:44 PDT 2021


david-arm marked an inline comment as done.
david-arm 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:
> 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?


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

https://reviews.llvm.org/D109883



More information about the llvm-commits mailing list