diff options
author | Nikita Popov <npopov@redhat.com> | 2024-08-14 09:37:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-14 09:37:38 +0200 |
commit | 6da3361f504495cef71caa4de4297234b6ea7fc7 (patch) | |
tree | d36749532614d52e1ebc635ab6698f1ca540f392 /llvm/lib/IR/Module.cpp | |
parent | 241f9e7492dae1920778ef4fe72db6073b6275b1 (diff) | |
download | llvm-6da3361f504495cef71caa4de4297234b6ea7fc7.zip llvm-6da3361f504495cef71caa4de4297234b6ea7fc7.tar.gz llvm-6da3361f504495cef71caa4de4297234b6ea7fc7.tar.bz2 |
[SCEV] Look through multiply in computeConstantDifference() (#103051)
Inside computeConstantDifference(), handle the case where both sides are
of the form `C * %x`, in which case we can strip off the common
multiplication (as long as we remember to multiply by it for the
following difference calculation).
There is an obvious alternative implementation here, which would be to
directly decompose multiplies inside the "Multiplicity" accumulation.
This does work, but I've found this to be both significantly slower
(because everything has to work on APInt) and more complex in
implementation (e.g. because we now need to match back the new More/Less
with an arbitrary factor) without providing more power in practice. As
such, I went for the simpler variant here.
This is the last step to make computeConstantDifference() sufficiently
powerful to replace existing uses of
`cast<SCEVConstant>(getMinusSCEV())` with it.
Diffstat (limited to 'llvm/lib/IR/Module.cpp')
0 files changed, 0 insertions, 0 deletions