[PATCH] D40554: [PowerPC] Fix bugs in sign-/zero-extension elimination
Hiroshi Inoue via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 8 06:50:53 PST 2018
inouehrs marked an inline comment as done.
inouehrs added inline comments.
================
Comment at: lib/Target/PowerPC/PPCInstrInfo.h:343
- bool isSignOrZeroExtended(const MachineInstr &MI, bool SignExt,
- const unsigned PhiDepth) const;
+ bool isSignOrZeroExtended(const unsigned Reg, bool SignExt,
+ const unsigned PhiDepth,
----------------
nemanjai wrote:
> inouehrs wrote:
> > nemanjai wrote:
> > > I still think this setup with separate queries for sign/zero/any extend seems unnecessarily complex. Seems like it would be clearer if we had an enum for the extension type (sign, zero, none) and we just have a single query that will return this. Therefore no need for Boolean parameters, no need for multiple functions, etc.
> > I agree that the single query approach is cleaner. But I am afraid that it will increase the cost of compilation slightly since it always checks for both sign- and zero-extensions. Do you think the potential increase in compilation cost does not matter too much here?
> It seems to me that the checks are not costly except in chained operations cases (which we traverse the chain as it is). Or am I missing something. What is the worst case complexity of the computations for each?
Thanks. I modified the helper to return `std::pair<bool, bool>`.
Do you prefer an enum?
https://reviews.llvm.org/D40554
More information about the llvm-commits
mailing list