[PATCH] D157511: GlobalISel: Add constant fold combine for zext/sext/anyext
Pierre van Houtryve via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 11 00:20:22 PDT 2023
Pierre-vh added inline comments.
================
Comment at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:641-644
+ bool matchConstantFoldCastOp(MachineInstr &MI, APInt &MatchInfo);
+
+ /// Do constant folding when opportunities are exposed after MIR building.
+ bool matchConstantFoldBinOp(MachineInstr &MI, APInt &MatchInfo);
----------------
nit: could remove the second comment and just put the decls right next to each other.
================
Comment at: llvm/lib/CodeGen/GlobalISel/Utils.cpp:785
+ case TargetOpcode::G_SEXT:
+ return Val->sext(DstTy.getScalarSizeInBits());
+ case TargetOpcode::G_ZEXT:
----------------
nit: put `DstTy.getScalarSizeInBits()` in a variable
================
Comment at: llvm/test/CodeGen/AArch64/GlobalISel/prelegalizercombiner-binop-same-val.mir:29
- ; Fold: x and x -> x
----------------
lost comments in this file
================
Comment at: llvm/test/CodeGen/AArch64/GlobalISel/prelegalizercombiner-bzero.mir:21
liveins: $x0, $x1
- ; Always use G_BZERO when the memset width is unknown on Darwin.
----------------
ditto
================
Comment at: llvm/test/CodeGen/AArch64/GlobalISel/prelegalizercombiner-trivial-arith.mir:29
liveins: $w0
- ; Fold (x + 0) -> x
- ;
----------------
ditto
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157511/new/
https://reviews.llvm.org/D157511
More information about the llvm-commits
mailing list