You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement vector constants in ClangIR.
Resolves issue llvm#498 - Add a `cir.const_vec`, simlar to `cir.const_array`
and `cir.const_struct`
Create a new kind of attribute, `cir::ConstVectorAttr` in the code or
`#cir.const_vector` in the assembly, which represents a compile-time
value of a `cir::VectorType`. The values for the elements within the
vector are stored as attributes within an `mlir::ArrayAttr`.
When doing CodeGen for a prvalue of vector type, try to represent it as
`cir.const #cir.const_vector` first. If that fails, most likely because
some of the elements are not compile-time values, fall back to the
existing code that uses a `cir.vec.create` operation.
When lowering directly to LLVM IR, lower `cir.const #cir.const_vector`
as `llvm.mlir.constant(dense<[...]> : _type_) : _type_`.
When lowering through other MLIR dialects, lower
`cir.const #cir.const_vector` as `arith.constant dense<[...]> : _type_`.
No new tests were added, but the expected results of the existing tests
that use vector constants were updated.
0 commit comments