[llvm] [GlobalIsel][NFC] Refactor ext of trunc (PR #92533)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Fri May 17 06:59:31 PDT 2024
================
@@ -735,18 +735,20 @@ def redundant_sext_inreg: GICombineRule <
// the destination type.
def anyext_trunc_fold: GICombineRule <
(defs root:$root, register_matchinfo:$matchinfo),
- (match (wip_match_opcode G_ANYEXT):$root,
- [{ return Helper.matchCombineAnyExtTrunc(*${root}, ${matchinfo}); }]),
- (apply [{ Helper.replaceSingleDefInstWithReg(*${root}, ${matchinfo}); }])
+ (match (G_TRUNC $input, $x),
----------------
jayfoad wrote:
`test_combine_anyext_trunc_with_hint` in `test/CodeGen/AArch64/GlobalISel/combine-ext.mir` tests this sequence:
```
%1:_(s32) = G_TRUNC %0(s64)
%2:_(s32) = G_ASSERT_ZEXT %1(s32), 11
%3:_(s64) = G_ANYEXT %2(s32)
```
I would expect your new matcher to not match this. How does it work?
https://github.com/llvm/llvm-project/pull/92533
More information about the llvm-commits
mailing list