[llvm] [GlobalISel] avoid G_TRUNC with floating-point G_MERGE_VALUES source (PR #206733)

Nathan Corbyn via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 9 01:59:40 PDT 2026


================
@@ -0,0 +1,72 @@
+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 6
+# RUN: llc -mtriple=aarch64 -run-pass=legalizer %s -o - | FileCheck %s
+
+# Regression test for LegalizationArtifactCombiner::tryCombineTrunc: a G_TRUNC
+# whose G_MERGE_VALUES source operands are floating-point must not fold to a
+# G_TRUNC (or rebuilt G_MERGE_VALUES) with a float source operand. The float
+# source is reinterpreted to an integer of the same size via G_BITCAST first.
+
+---
+# DstSize < MergeSrcSize - trunc folds trought the merge to the first source.
----------------
cofibrant wrote:

```suggestion
# DstSize < MergeSrcSize - trunc folds through the merge to the first source.
```

https://github.com/llvm/llvm-project/pull/206733


More information about the llvm-commits mailing list