Merge duplicated code into procedure for code cleanness and readability and use llvm::dbgs() instead of errs() for consistency with other parts.
Details
Diff Detail
Event Timeline
I don't think the setMIFlags() call belongs in the helper; it's technically duplicated across all the functions, but it's conceptually part of creating an equivalent instruction, and the steps for that are different in each place.
I don't think refactoring the debug counter increment is helpful; counters aren't normally passed around that way, so it's a bit confusing to follow.
At that point, the helper is basically three lines, so I'm not sure the refactoring is worthwhile. Maybe if you wanted to add something else to the refactored function, but I'm not sure what that would be.
llvm/lib/Target/ARM/Thumb2SizeReduction.cpp | ||
---|---|---|
413 | "llvm::" prefix isn't necessary; this file is "using namespace llvm". |
Thanks for the review and it sounds a good rationale. I am also wondering whether only changing errs to dbgs on the original code without changing other parts or using helper function a good change for consistency with other code?
"llvm::" prefix isn't necessary; this file is "using namespace llvm".