[PATCH] D22175: InstCombine rule for trunc feeding from prior load/store
Anna Thomas via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 12 06:36:50 PDT 2016
anna added a comment.
Summary of why we need the check for Data Layout being Little Endian.
Consider this (pseudo) example:
i16 type (narrow) store at addr a
i32 type (wide) load from addr a
trunc i32 to i16
The load/store of value into memory depends on the layout -- big endian or little endian. However, when loaded into register, the value is stored as MSB...LSB in register. The trunc operation done on the register value extracts the lower order bits. So, we cannot substitute the trunc with the store when the layout is BE. For BE layout, we need to confirm the partial memory contents extracted from the narrow load/store is the *same value* as generated by the trunc.
See example: `trunc_load_store` (different sized store compared to load at same memory location).
http://reviews.llvm.org/D22175
More information about the llvm-commits
mailing list