[llvm] [SelectionDAG] Use getVectorElementPointer in DAGCombiner::replaceStoreOfInsertLoad. (PR #74249)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 3 17:55:54 PST 2023


================
@@ -9,6 +9,7 @@ define void @foo(ptr %0, ptr %1, ptr %2) #0 {
 ; CHECK:       ## %bb.0:
 ; CHECK-NEXT:    movl (%rdx), %eax
 ; CHECK-NEXT:    vpinsrw $0, (%rdi), %xmm0, %xmm0
+; CHECK-NEXT:    andl $15, %eax
----------------
topperc wrote:

> We do we need to limit the range? The [LangRef](https://llvm.org/docs/LangRef.html#insertelement-instruction) says "If idx exceeds the length of val for a fixed-length vector, the result is a poison value."

Since we convert the index to be part of the address we can store outside the bounds of the original store. When it was a vector store only the vector starting at the base address was poisoned.

https://github.com/llvm/llvm-project/pull/74249


More information about the llvm-commits mailing list