Commit 51eee20
authored
[Mips] Fix clang crashes when assembling invalid MIPS beql instructions with --arch=mips (#156413)
From clang version 4, mips append new instruction BeqImm and
BEQLImm, the second operand format of instruction is imm64:$imm.
1.When Mips process `beql $t0, ($t0), 1`, it think the second operand
was an imm, so match success. Then mips backend process expandBranchImm,
check the second operand `$t0` was not imm, reported asserts.
We can strengthen the second operand matching restrictions.
2.Similarly, when Mips process `beql $t0, (1), 1`, it think the second
was an imm. so match success. Then mips backend process expandBranchImm,
check the third operand `1` was not expression, reported asserts. Permit
the third operand of `beql` to be imm.
Fixes #151453.1 parent ef4598f commit 51eee20
File tree
3 files changed
+22
-4
lines changed- llvm
- lib/Target/Mips
- AsmParser
- test/MC/Mips
3 files changed
+22
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3677 | 3677 | | |
3678 | 3678 | | |
3679 | 3679 | | |
3680 | | - | |
| 3680 | + | |
3681 | 3681 | | |
3682 | 3682 | | |
3683 | 3683 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
855 | 855 | | |
856 | 856 | | |
857 | 857 | | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
858 | 868 | | |
859 | 869 | | |
860 | 870 | | |
| |||
2947 | 2957 | | |
2948 | 2958 | | |
2949 | 2959 | | |
2950 | | - | |
| 2960 | + | |
2951 | 2961 | | |
2952 | 2962 | | |
2953 | | - | |
| 2963 | + | |
2954 | 2964 | | |
2955 | 2965 | | |
2956 | 2966 | | |
| |||
2978 | 2988 | | |
2979 | 2989 | | |
2980 | 2990 | | |
2981 | | - | |
| 2991 | + | |
2982 | 2992 | | |
2983 | 2993 | | |
2984 | 2994 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
3 | 11 | | |
4 | 12 | | |
5 | 13 | | |
| |||
0 commit comments