[llvm] [C API] Add function to create constantRange attributes to C API (PR #90505)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed May 1 18:52:49 PDT 2024


================
@@ -178,6 +179,18 @@ LLVMTypeRef LLVMGetTypeAttributeValue(LLVMAttributeRef A) {
   return wrap(Attr.getValueAsType());
 }
 
+LLVMAttributeRef LLVMCreateConstantRangeAttribute(
+    LLVMContextRef C, unsigned KindID, unsigned NumBits, unsigned LowerNumWords,
+    const uint64_t LowerWords[], unsigned UpperNumWords,
+    const uint64_t UpperWords[]) {
----------------
nikic wrote:

Not entirely sure on this, but I think it would be better to drop it. In bitcode, we encode APInts with leading zeros with less words than their bitwidth would ordinarily use, and have to separately consider BitWidth and NumWords because of that. But I can't really think of a good reason why frontend callers of this API would need this kind of micro-optimization.

https://github.com/llvm/llvm-project/pull/90505


More information about the llvm-commits mailing list