[PATCH] D55169: [ConstantFolding] Handle leading zero-length elements in load folding

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 11 11:33:03 PST 2018


efriedma accepted this revision.
efriedma added a comment.
This revision is now accepted and ready to land.

LGTM.  (We should fix the constant stuff to be consistent with the type system at some point, but not urgent, I guess.)



================
Comment at: test/Transforms/ConstProp/loads.ll:309
+; BE-LABEL: @test_array_of_zero_size_array(
+; BE: ret i64 0
+}
----------------
nikic wrote:
> This result is unrelated to this patch, but I'm wondering if it's correct. Is this folding to zero based on UB, as this is effectively an out-of-bounds access to a constant array?
Yes, it's ignoring the offset because any well-defined load from a zeroinitializer constant must return zero.


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

https://reviews.llvm.org/D55169





More information about the llvm-commits mailing list