[PATCH] D135263: [ValueTracking][SimplifyLibCalls] Fix bug in getConstantDataArrayInfo for wchar_t

Karl-Johan Karlsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 5 23:38:01 PDT 2022


Ka-Ka added inline comments.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:4269
+  assert((StartIdx % ElementSizeInBytes) == 0 &&
+         "Constant offset not a multiple of the ElementSize.");
+  Offset += StartIdx / ElementSizeInBytes;
----------------
nikic wrote:
> I don't think this assertions holds. What happens if you have something like `getelementptr i8, ptr @ws, i64 3`?
I guess it is better to simply return false instead of hitting an assert like this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135263



More information about the llvm-commits mailing list