[llvm] [NFC] Reduce copies created of ConstantRange when getting ConstantRangeAttributes. (PR #90335)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 28 18:55:28 PDT 2024


================
@@ -2199,8 +2199,8 @@ class CallBase : public Instruction {
   FPClassTest getParamNoFPClass(unsigned i) const;
 
   /// If this return value has a range attribute, return the value range of the
-  /// argument. Otherwise, std::nullopt is returned.
-  std::optional<ConstantRange> getRange() const;
+  /// argument. Otherwise, nullptr is returned.
+  const ConstantRange *getRange() const;
----------------
nikic wrote:

I'm not sure about this one -- e.g. if we wanted to intersect the range on the call and the declaration, we'd no longer be able to do it with this API...

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


More information about the llvm-commits mailing list