[PATCH] D46018: [GlobalISel][IRTranslator] Split aggregates during IR translation

Roman Tereshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 15 02:11:53 PDT 2018


rtereshin added inline comments.


================
Comment at: lib/CodeGen/GlobalISel/IRTranslator.cpp:1318
+          MIB.addUse(ValRegs[i]);
+          MIB.addMBB(Pred);
+        }
----------------
rtereshin wrote:
> There are two `i`s in scope here. Do we have a test covering this?
I think I've got a couple of tests for `PHI`s. They both seem to translate correctly:

[[ https://gist.github.com/ramntry/68a9d5e8f309df58497d2901788571a2 | test_phi_diamond.ll ]]
[[ https://gist.github.com/ramntry/f3aa15e826660bebc94d0acc59dfd29d | test_phi_loop.ll ]]

The `test_phi_loop.ll` one translates rather beautifully IMO:
```
body:             |
  bb.1.entry:
    liveins: $w0

    %0:_(s32) = COPY $w0
    %5:_(s32) = G_CONSTANT i32 1
    %7:_(s32) = G_CONSTANT i32 0
    %9:_(s64) = G_CONSTANT i64 0
    %10:_(s64) = G_CONSTANT i64 1

  bb.2.loop:
    %1:_(s32) = G_PHI %0(s32), %bb.1, %6(s32), %bb.2
    %2:_(s64) = G_PHI %9(s64), %bb.1, %3(s64), %bb.2
    %3:_(s64) = G_PHI %10(s64), %bb.1, %4(s64), %bb.2
    %4:_(s64) = G_ADD %2, %3
    %6:_(s32) = G_SUB %1, %5
    %8:_(s1) = G_ICMP intpred(sle), %1(s32), %7
    G_BRCOND %8(s1), %bb.3
    G_BR %bb.2

  bb.3.exit:
    $x0 = COPY %2(s64)
    RET_ReallyLR implicit $x0
```



Repository:
  rL LLVM

https://reviews.llvm.org/D46018





More information about the llvm-commits mailing list