[llvm] Local: Handle noalias_addrspace in combineMetadata (PR #103938)

Fraser Cormack via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 22 02:17:57 PDT 2024


================
@@ -60,7 +60,7 @@ class [[nodiscard]] ConstantRangeList {
   bool empty() const { return Ranges.empty(); }
 
   /// Get the bit width of this ConstantRangeList.
-  uint32_t getBitWidth() const { return 64; }
+  uint32_t getBitWidth() const { return Ranges.front().getBitWidth(); }
----------------
frasercrmck wrote:

If the range list is empty, should this continue to return 64? Otherwise at best it'll assert and at worst it'll return garbage. An `optional` could also represent this scenario.

If there's a new precondition that you can only call `getBitWidth` on a non-empty range, that should be documented.

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


More information about the llvm-commits mailing list