This revision supports to fold vector.extractelement (splat X) -> X.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/Dialect/Vector/IR/VectorOps.cpp | ||
---|---|---|
954–956 | But if the position exceeds the range of the vector, the result should be a poison value? Could we ignore this possibility? |
mlir/lib/Dialect/Vector/IR/VectorOps.cpp | ||
---|---|---|
954–956 | Good question. There is no poison semantics in MLIR. I would interpret accessing out of bounds as C-style UB, at which point folding it to the splat value is as valid as any other behavior. |
mlir/lib/Dialect/Vector/IR/VectorOps.cpp | ||
---|---|---|
954–956 | I agree. Note that llvm also does this optimization in this case: |
Can't we? If we are extracting the element from a splat, isn't it always the same regardless of the position?