The DAGCombiner helper function canFoldInAddressingMode performs some checks for legal addressing modes, such as reg+imm. The TargetLowering::AddrMode struct used for that check should have the HasBaseReg field set to true to indicate the presence of a reg (other than the scale reg). The function did not set that field (and by default it's false). This patch corrects that oversight. No tests were impacted by the change, as the oversight did not seem to manifest as an actual problem at the moment.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
Probably better to put it inside the branches for ADD/SUB, to make it clear that it's those specific operations that have a base register?
Given the current places we call canFoldInAddressingMode, and that the relevant targets are missing HasBaseReg checks (in particular, I looked at ARM and AArch64), I imagine it would be very hard to reproduce any effective change, yes. (Maybe you could come up with something for 32-bit ARM if you tried hard enough, but it's probably not worth bothering.)
Comment Actions
With Eli's suggested change (sinking the assignment to the ADD/SUB branches), this seems good to me.