Commit 13bee3a
[Mips] Fix clang crashes when assembling invalid MIPS beql instructions with --arch=mips (llvm#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 llvm#151453.
(cherry picked from commit 51eee20)1 parent 0d1b924 commit 13bee3a
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 | |
|---|---|---|---|
| |||
3676 | 3676 | | |
3677 | 3677 | | |
3678 | 3678 | | |
3679 | | - | |
| 3679 | + | |
3680 | 3680 | | |
3681 | 3681 | | |
3682 | 3682 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
858 | 858 | | |
859 | 859 | | |
860 | 860 | | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
861 | 871 | | |
862 | 872 | | |
863 | 873 | | |
| |||
2950 | 2960 | | |
2951 | 2961 | | |
2952 | 2962 | | |
2953 | | - | |
| 2963 | + | |
2954 | 2964 | | |
2955 | 2965 | | |
2956 | | - | |
| 2966 | + | |
2957 | 2967 | | |
2958 | 2968 | | |
2959 | 2969 | | |
| |||
2981 | 2991 | | |
2982 | 2992 | | |
2983 | 2993 | | |
2984 | | - | |
| 2994 | + | |
2985 | 2995 | | |
2986 | 2996 | | |
2987 | 2997 | | |
| |||
| 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