Optimize (add (mul x, c0), c1) -> (add (mul (add x, c1/c0+1), c0), c1%c0-c0), if c1/c0+1 and c1%c0-c0 are simm12, while c1 is not. Optimize (add (mul x, c0), c1) -> (add (mul (add x, c1/c0-1), c0), c1%c0+c0), if c1/c0-1 and c1%c0+c0 are simm12, while c1 is not.
Details
Details
Diff Detail
Diff Detail
Event Timeline
llvm/lib/Target/RISCV/RISCVISelLowering.cpp | ||
---|---|---|
6451 ↗ | (On Diff #379580) | Repeated comments are removed. |
Comment Actions
I've suggested a slight tweak to the explanatory comments.
llvm/lib/Target/RISCV/RISCVISelLowering.cpp | ||
---|---|---|
6404 ↗ | (On Diff #379580) | "A special corner case that should be excluded is when ..., which will lead to an infinite loop in DAGCombine if transformed." would read more clearly (same for other instances below). |
Comment Actions
I think this is correct. I'd certainly appreciate another pair of eyes confirming they agree though!