[llvm] [TwoAddressInstruction] Check if segment was found when updating subreg LIs (PR #65916)

Piyou Chen via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 10 22:50:51 PDT 2023


BeMg wrote:

Hi @lukel97 

I do some experiment which recompute the LiveInterval even it has subrange inside TwoAddressInstructionPass pass.

```
// Orgin LiveIntervals before updating LiveIntervals.
********** INTERVALS **********
V8 [0B,16r:0) 0 at 0B-phi
%0 [16r,32r:0) 0 at 16r  weight:0.000000e+00
%1 [32r,48r:0) 0 at 32r  L000000000000003C [32r,48r:0) 0 at 32r  L00000000000003C0 [32r,32d:0) 0 at 32r  weight:0.000000e+00
%2 EMPTY  weight:0.000000e+00
%3 [48r,48d:0) 0 at 48r  weight:0.000000e+00
RegMasks:
********** MACHINEINSTRS **********
# Machine code for function insert_v2i64_nxv16i64: NoPHIs, TracksLiveness, TiedOpsRewritten

0B      bb.0:
          liveins: $v8
16B       %0:vr = COPY $v8
32B       undef %1.sub_vrm1_0:vrm8 = COPY %0:vr
48B       dead %3:vrm4 = COPY %1.sub_vrm4_0:vrm8
64B       PseudoRET

# End machine code for function insert_v2i64_nxv16i64.
```

```
// Update LiveIntervals with Recompute by LIS's member function
// Something like 
// LIS->removeInterval(Reg);
// LIS->createAndComputeVirtRegInterval(Reg);
********** INTERVALS **********
V8 [0B,16r:0) 0 at 0B-phi
%0 [16r,32r:0) 0 at 16r  weight:0.000000e+00
%1 [32r,48r:0) 0 at 32r  L0000000000000004 [32r,48r:0) 0 at 32r  weight:0.000000e+00
%2 EMPTY  weight:0.000000e+00
%3 [48r,48d:0) 0 at 48r  weight:0.000000e+00
RegMasks:
********** MACHINEINSTRS **********
# Machine code for function insert_v2i64_nxv16i64: NoPHIs, TracksLiveness, TiedOpsRewritten

0B      bb.0:
          liveins: $v8
16B       %0:vr = COPY $v8
32B       undef %1.sub_vrm1_0:vrm8 = COPY %0:vr
48B       dead %3:vrm4 = COPY %1.sub_vrm4_0:vrm8
64B       PseudoRET

# End machine code for function insert_v2i64_nxv16i64.
```

```
// Update LiveIntervals by your patch
********** INTERVALS **********
V8 [0B,16r:0) 0 at 0B-phi
%0 [16r,32r:0) 0 at 16r  weight:0.000000e+00
%1 [32r,48r:0) 0 at 32r  L000000000000003C [32r,48r:0) 0 at 32r  L00000000000003C0 [32r,32d:0) 0 at 32r  weight:0.000000e+00
%2 EMPTY  weight:0.000000e+00
%3 [48r,48d:0) 0 at 48r  weight:0.000000e+00
RegMasks:
********** MACHINEINSTRS **********
# Machine code for function insert_v2i64_nxv16i64: NoPHIs, TracksLiveness, TiedOpsRewritten

0B      bb.0:
          liveins: $v8
16B       %0:vr = COPY $v8
32B       undef %1.sub_vrm1_0:vrm8 = COPY %0:vr
48B       dead %3:vrm4 = COPY %1.sub_vrm4_0:vrm8
64B       PseudoRET

# End machine code for function insert_v2i64_nxv16i64.
```

Should they achieve the same result?

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


More information about the llvm-commits mailing list