[PATCH] D141014: [Support][SelectionDAG][GlobalISel] Hoist PostShift adjustment for IsADd into UnsignedDivideUsingMagic.
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 4 14:08:32 PST 2023
lebedev.ri added inline comments.
================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:4965-4966
- if (!magics.IsAdd) {
- assert(magics.ShiftAmount < Divisor.getBitWidth() &&
- "We shouldn't generate an undefined shift!");
- PostShift = magics.ShiftAmount;
- PreShift = magics.PreShift;
- } else {
- assert(magics.PreShift == 0 && "Unexpected pre-shift");
- PostShift = magics.ShiftAmount - 1;
- SelNPQ = true;
- }
+ assert(magics.ShiftAmount < Divisor.getBitWidth() &&
+ "We shouldn't generate an undefined shift!");
+ assert((!magics.IsAdd || magics.PreShift == 0) && "Unexpected pre-shift");
----------------
Probably want similar assertion for `PreShift`?
================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:6059-6060
- if (!magics.IsAdd) {
- assert(magics.ShiftAmount < Divisor.getBitWidth() &&
- "We shouldn't generate an undefined shift!");
- PostShift = magics.ShiftAmount;
- PreShift = magics.PreShift;
- } else {
- assert(magics.PreShift == 0 && "Unexpected pre-shift");
- PostShift = magics.ShiftAmount - 1;
- SelNPQ = true;
- }
+ assert(magics.ShiftAmount < Divisor.getBitWidth() &&
+ "We shouldn't generate an undefined shift!");
+ assert((!magics.IsAdd || magics.PreShift == 0) &&
----------------
Probably want similar assertion for `PreShift`?
================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:6063
+ "Unexpected pre-shift");
+ PostShift = magics.ShiftAmount;
+ PreShift = magics.PreShift;
----------------
The name `PostShift` be propagated into `UnsignedDivisionByConstantInfo` struct?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141014/new/
https://reviews.llvm.org/D141014
More information about the llvm-commits
mailing list