[PATCH] D82892: [NFC] Added comparision for all types in haveSameSpecialState() of Instruction.cpp

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 31 11:41:19 PDT 2020


nikic added inline comments.


================
Comment at: llvm/lib/IR/Instructions.cpp:161
+  case Type::PointerTyID:
+    assert(PTyL && PTyR && "Both types must be pointers here.");
+    return compareIntegers(PTyL->getAddressSpace(), PTyR->getAddressSpace());
----------------
The compareTypes() function looks a bit problematic to me. The issue is that MergeFunctions considers integer types and all pointer types of the same size equal. Other places in LLVM require that the type must be exactly identical. The function as implemented here seems to go some middle way, where pointers are not considered equal to integers, but all pointer types are the same. That's in the spirit of opaque pointers, but we're not there yet.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82892



More information about the llvm-commits mailing list