strcpy optimization to i32 instead of i64 stores

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

strcpy optimization to i32 instead of i64 stores

Bjorn De Sutter
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





_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: strcpy optimization to i32 instead of i64 stores

Tim Northover-2
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.
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev