Select usub_sat directly for the memset length calculation, instead
of using a cmp/sub/select pattern than InstCombine later would turn
into usub_sat.
Details
Details
- Reviewers
- None
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/include/llvm/IR/IRBuilder.h | ||
---|---|---|
945 | Looks like we do not handle this in the ConstantFolder so if LHS and RHS are constant the usub_sat will remain in the IR until we simplify this. | |
llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp | ||
1279 | Maybe this isn't always desired. One situation I could imagine is that if for example the code is comparing DestSize and SrcSize for other reasons, then maybe the InstCombine transform is more careful and thinking that it isn't preferable to use usub_sat as we need to do the comparison anyhow. |
Looks like we do not handle this in the ConstantFolder so if LHS and RHS are constant the usub_sat will remain in the IR until we simplify this.