[PATCH] D89218: [DebugInfo] Support for DW_TAG_generic_subrange

Alok Kumar Sharma via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 13 04:59:37 PDT 2020


alok marked an inline comment as done.
alok added inline comments.


================
Comment at: llvm/lib/IR/LLVMContextImpl.h:369
+      ConstantAsMetadata *MD1 = dyn_cast_or_null<ConstantAsMetadata>(Node1);
+      ConstantAsMetadata *MD2 = dyn_cast_or_null<ConstantAsMetadata>(Node2);
+      if (MD1 && MD2) {
----------------
aprantl wrote:
> Why is `Node1 == Node2` not enough here?
This is to cover cases arising due to below getters of ConstantInt.
 -----------
  ConstantInt *getInt8(uint8_t C) {
    return ConstantInt::get(getInt8Ty(), C);
  }

  /// Get a constant 16-bit value.
  ConstantInt *getInt16(uint16_t C) {
    return ConstantInt::get(getInt16Ty(), C);
  }

  /// Get a constant 32-bit value.
  ConstantInt *getInt32(uint32_t C) {
    return ConstantInt::get(getInt32Ty(), C);
  }

  /// Get a constant 64-bit value.
  ConstantInt *getInt64(uint64_t C) {
    return ConstantInt::get(getInt64Ty(), C);
  }
 -----------
For the same value say C=1, different getIntX gives different Nodes. So it looks better to compare values and ignoring size/type.


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

https://reviews.llvm.org/D89218



More information about the llvm-commits mailing list