<div dir="ltr"><div>Hello, LLVM Devs.</div><div><br></div><div>I'm compiling following code using my own backend:</div><div><br></div><div>int foo() {<br>    char arr[4];<br>    arr[0] = 0xAA;<br>    arr[1] = 0xBB;<br>    arr[2] = 0xCC;<br>    arr[3] = 0xDD;<br>    return *(int*)&arr[0];<br>}</div><div><br></div><div>The memory operation in "return" statement ends up transformed into 4-byte load in the initial DAG:</div><div><br></div><div>load<(dereferenceable load 4 from %ir.7, align 1, addrspace 1)> t31, FrameIndex:i32<0>, ...</div><div><br></div><div>However, at the "Legalized selection DAG" stage things go differently, depending on the OS I'm running. On Windows this load stay in its previous form, but on FreeBSD this load gets turned into 1-byte loads for some reason:</div><div><br></div><div>load<(dereferenceable load 1 from %ir.7, addrspace 1)<br></div><div>load<(dereferenceable load 1 from %ir.7 + 1, addrspace 1)<br></div><div>...</div><div><br></div><div>Can anyone give me a hint why this happens? Optimization level is the same and FastISel is used in both cases.</div><div><br></div><div>Thanks in advance.<br></div></div>