================
@@ -2213,7 +2213,14 @@ Value
*ScalarExprEmitter::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
if (CGF.SanOpts.has(SanitizerKind::ArrayBounds))
CGF.EmitBoundsCheck(E, E->getBase(), Idx, IdxTy, /*Accessed*/true);
- return Builder.CreateExtractElement(Base, Idx, "vecext");
+ Value *Ret = Builder.CreateExtractElement(Base, Idx, "vecext");
+
+ // Even being a scalar the `__mfp8` type corresponds to `<1 x i8>` in LLVM
IR.
+ // Cast the extracted element to the vector type to keep it consistent in
+ // Clang.
+ if (E->getType()->isMFloat8Type())
+ Ret = Builder.CreateBitCast(Ret, ConvertType(E->getType()), "mfp8ext");
----------------
momchil-velikov wrote:
Seem `insertelement` is the most sensible op to emit and it will either be left
intact by `instcombine` or changed to a `shufflevector` if the index is a
constant.
https://github.com/llvm/llvm-project/pull/192977
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits