9 Commits

Author SHA1 Message Date
Paul Bowen-Huggett
ee7ca0ddda
Make CombinerHelper methods const (#119529)
There are a number of backends (specifically AArch64, AMDGPU, Mips, and
RISCV) which contain a “TODO: make CombinerHelper methods const”
comment. This PR does just that and makes all of the CombinerHelper
methods const, removes the TODO comments and makes the associated
instances const. This change makes some sense because the CombinerHelper
class simply modifies the state of _other_ objects to which it holds
pointers or references.

Note that AMDGPU contains an identical comment for an instance of
AMDGPUCombinerHelper (a subclass of CombinerHelper). I deliberately
haven’t modified the methods of that class in order to limit the scope
of the change. I’m happy to do so either now or as a follow-up.
2024-12-20 08:29:18 +07:00
Kazu Hirata
f01b62ad48 [GlobalISel] Fix warnings
This patch fixes:

  llvm/lib/CodeGen/GlobalISel/CombinerHelperCasts.cpp:167:21: error:
  unused variable 'DL' [-Werror,-Wunused-variable]

  llvm/lib/CodeGen/GlobalISel/LoadStoreOpt.cpp:320:15: error: unused
  variable 'DL' [-Werror,-Wunused-variable]
2024-12-13 10:24:06 -08:00
Craig Topper
0d9fc17433
[GISel] Remove unused DataLayout operand from getApproximateEVTForLLT (#119833) 2024-12-13 09:09:20 -08:00
Thorsten Schütt
ba4bcce5f5
[GlobalIsel] Combine trunc of binop (#107721)
trunc (binop X, C) --> binop (trunc X, trunc C)  --> binop (trunc X, C`)

Try to narrow the width of math or bitwise logic instructions by pulling
a truncate ahead of binary operators.

Vx and Nx cores consider 32-bit and 64-bit basic arithmetic equal in
costs.
2024-09-11 15:04:55 +02:00
Thorsten Schütt
0b0ccd56c9
[GlobalIsel] Push cast through build vector (#104634)
Credits: https://github.com/llvm/llvm-project/pull/100563
2024-08-21 10:10:36 +02:00
Thorsten Schütt
710a552ded
[GlobalIsel] Revisit ext of ext. (#102769)
Credits:
https://reviews.llvm.org/D86516

combine-ext.mir

Notable semantic changes:
InstCombine does not mix zero and sign extend,
  see CastInst::isEliminableCastPair.
New version has legality checks.
Folds sext/zext of anyext -> sext/zext
Support for nneg

Future work:
nneg zext of sext -> sext
sext of nneg zext -> sext
2024-08-16 15:38:56 +02:00
Thorsten Schütt
db8c84fc7a
[GlobalIsel] Push cast through select. (#100539) 2024-07-25 19:21:28 +02:00
Thorsten Schütt
bfcfb0fd2d
[GlobalIsel] Modernize truncate of ext. (#100338)
Credits:
https://github.com/llvm/llvm-project/pull/90964
https://reviews.llvm.org/D87050

combine-trunc.mir

Functional changes intended.
2024-07-24 22:13:52 +02:00
Thorsten Schütt
2ca300f914
[GlobalIsel][NFC] Move cast code (#100196)
Preparation for more cast combines
2024-07-24 06:33:11 +02:00