This patch cleans up parts of InstCombine to raise its compliance with the LLVM coding standards and to increase its readability. The changes and according rationale are summarized in the following:
- Rename ShouldOptimizeCast() to shouldOptimizeCast() since functions should start with a lower case letter.
- Move shouldOptimizeCast() from InstCombineCasts.cpp to InstCombineAndOrXor.cpp since it's only used there.
- Simplify interface of shouldOptimizeCast().
- Minor code style adaptions in shouldOptimizeCast().
- Remove the documentation on the function definition of shouldOptimizeCast() since it just repeats the documentation on its declaration. Also enhance the documentation on its declaration with more information describing its intended use and make it doxygen-compliant.
- Change a comment in foldCastedBitwiseLogic() from fold (logic (cast A), (cast B)) -> (cast (logic A, B)) to fold logic(cast(A), cast(B)) -> cast(logic(A, B)) since the surrounding comments use this format.
- Remove comment Only do this if the casts both really cause code to be generated. in foldCastedBitwiseLogic() since it just repeats parts of the documentation of shouldOptimizeCast() and does not help to improve readability.
- Simplify the interface of isEliminableCastPair().
- Removed the documentation on the function definition of isEliminableCastPair() which only contained obvious statements about its implementation. Instead added more general doxygen-compliant documentation to its declaration.
- Renamed parameter DoXform of transformZExtIcmp() to DoTransform to make its intention clearer.
- Moved documentation of transformZExtIcmp() from its definition to its declaration and made it doxygen-compliant.
Please put returns on their own line.