Is it just an optimization pass? Maybe I can cancel it somehow with a flag or by doing some code editing? Can you point me to which passes may do that?
I’m working on editing a backend that can’t work with anything larger than 32 bits. Does the legalize stage work on IR code? Maybe i can use that?
Generally legalize at IR level is not a good idea.
But if you need legalization on IR code, you can check PNaCl project. https://chromium.googlesource.com/native_client/pnacl-llvm/
The pass is located at: lib/Transforms/NaCl/ExpandLargeIntegers.cpp
You need make some change, as the pass split large integer into 64bit integers.
It’s a pretty simple code change to make ExpandLargeIntegers support arbitrary power-of-two max sizes. Please let us know if that would be helpful to you, or send us patches. We plan to propose this pass to upstream once it implements more instructions.