LLVM Dialect GlobalOp String

Problem statement is to create a string constant using mlir’s LLVM dialect. It has an operation named “GlobalOp” with which different type of constant/non-constants can be created.

I am trying to emit this mlir ir statement :
llvm.mlir.global @string("aa") : !llvm.array<2 x i8>

My code :

llvm::StringRef name="aa";
llvm::StringRef value=StringRef("\n\0", 2);
auto type = LLVM::LLVMArrayType::get(IntegerType::get(builder.getContext(), 8), value.size());
    LLVM::GlobalOp global = builder.create<LLVM::GlobalOp>(loc, type, /*isConstant=*/true, 
                                            LLVM::Linkage::Internal, name, builder.getStringAttr(value),0);

Output :

"llvm.mlir.global"() ({
    }) {addr_space = 0 : i32, constant, global_type = !llvm.array<2 x i8>, linkage = #llvm.linkage<internal>, sym_name = "aa", value = "aa", visibility_ = 0 : i64} : () -> ()

As I was creating it in local space which resulted in the incorrect output. Adding it to global area, it worked. (module body)