HomePhabricator

Improve handling of COPY instructions with identical value numbers

Description

Improve handling of COPY instructions with identical value numbers

Differential Revision: https://reviews.llvm.org/D48102

Event Timeline

@kparzysz This is failing when EXPENSIVE_CHECKS is enabled:

*** Bad machine code: Virtual register defs don't dominate all uses. ***
- function:    _amdgpu_cs_main
- v. register: %44

*** Bad machine code: Multiple connected components in live interval ***
- function:    _amdgpu_cs_main
- interval:    %32 [32r,32d:5)[80r,80d:3)[128r,128d:4)[176r,176d:6)[224r,224d:7)
[272r,272d:8)[320r,320d:9)[368r,368d:10)[416r,448r:11)[448r,560B:12)[560B,816r:0
)[816r,992B:1)  0@560B-phi 1@816r 2@x 3@80r 4@128r 5@32r 6@176r 7@224r 8@272r 9@
320r 10@368r 11@416r 12@448r L00000002 [32r,32d:2)[80r,80d:1)[128r,128d:0)[176r,
176d:3)[224r,224d:4)[272r,272d:5)[320r,320d:6)[368r,368d:7)[416r,416d:8)[816r,81
6d:9)  0@128r 1@80r 2@32r 3@176r 4@224r 5@272r 6@320r 7@368r 8@416r 9@816r 10@x
L00000004 [448r,560B:1)[560B,992B:3)  0@x 1@448r 2@x 3@560B-phi weight:0.000000e
+00
0: valnos 0 1 2 11 12
1: valnos 3
2: valnos 4
3: valnos 5
4: valnos 6
5: valnos 7
6: valnos 8
7: valnos 9
8: valnos 10

*** Bad machine code: Register not marked live out of predecessor ***
- function:    _amdgpu_cs_main
- basic block: %bb.0 .entry (0xcc9418) [0B;560B)
- liverange:   [560B,784r:0)[784r,992B:1)  0@560B-phi 1@784r
- v. register: %44
- ValNo:       0 (def 560B)
 live into %bb.1@560B, not live before 560B
LLVM ERROR: Found 3 machine code errors.

Reverted in r334598.

This testcase fails with expensive checks even without this patch.