strcpy optimization to i32 instead of i64 stores

Hi,

For my 32-bit architecture backend, I run into trouble because strcpy is converted into i64 store instructions, on which instruction selection fails. No i64 store is declared anywhere in my .td files or architecture backend, so I would assume that they are automatically converted into 2 i32 stores, but apparently, that is not the case. Do I need to add anything to my backend to have this types of i64 stores converted into 2 i32 stores? Or can I easily avoid that opt or clang create the i64 instructions in the first place?

Thanks,

Bjorn De Sutter
Computer Systems Lab
Ghent University

Hi Bjorn,

Do I need to add anything to my backend to have this types of i64 stores converted into 2 i32 stores?

It looks like you need to override "getOptimalMemOpType" in
XXXISelLowering.cpp. It's used by FindOptimalMemOpLowering in
SelectionDAG.cpp.

Or can I easily avoid that opt or clang create the i64 instructions in the first place?

That's more tricky, but it looks like the relevant functions are
"gerMaxStoresPerMemcpy", "getMaxStoresPerMemmove" and
"getMaxStoresPerMemset". I don't think they would stop it entirely
though, just discourage it.

Cheers.

Tim.