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

Andreas Jonson via llvm-commits llvm-commits at lists.llvm.org
Wed May 1 00:03:33 PDT 2024


================
@@ -71,8 +71,8 @@ class Argument final : public Value {
   FPClassTest getNoFPClass() const;
 
   /// If this argument 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;
----------------
andjo403 wrote:

Yes agree was thinking about it when I hade the two ifs after each other but was to deep in save copies mode to stop and reflect. Pushed a new commit as there was so mush removed so a fix commit did not make sense.

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


More information about the llvm-commits mailing list