[PATCH] D157655: [Mips] AttemptToFoldSymbolOffsetDifference: revert isMicroMips special case

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 16 23:12:12 PDT 2023


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4c89277095ee: [Mips][MC] AttemptToFoldSymbolOffsetDifference: revert isMicroMips special case (authored by MaskRay).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157655/new/

https://reviews.llvm.org/D157655

Files:
  llvm/lib/MC/MCExpr.cpp
  llvm/test/CodeGen/Mips/micromips-b-range.ll
  llvm/test/CodeGen/Mips/micromips-gcc-except-table.ll
  llvm/test/DebugInfo/Mips/eh_frame.ll


Index: llvm/test/DebugInfo/Mips/eh_frame.ll
===================================================================
--- llvm/test/DebugInfo/Mips/eh_frame.ll
+++ llvm/test/DebugInfo/Mips/eh_frame.ll
@@ -26,9 +26,9 @@
 ; CHECK-READELF-PIC-NEXT: R_MIPS_PC32
 ; CHECK-READELF-NEXT: .gcc_except_table
 
-; EXCEPT-TABLE-STATIC: 0000 ff9b1501 0c011500 00150e23 01231e00  ...........#.#..
+; EXCEPT-TABLE-STATIC: 0000 ff9b1501 0c001400 00140e22 01221e00 ..........."."..
 ; EXCEPT-TABLE-STATIC: 0010 00010000 00000000
-; EXCEPT-TABLE-PIC:    0000 ff9b1501 0c012d00 002d133f 013f2a00 ......-..-.?.?*.
+; EXCEPT-TABLE-PIC:    0000 ff9b1501 0c002c00 002c123e 013e2a00 ......,..,.>.>*.
 ; EXCEPT-TABLE-PIC:    0010 00010000 00000000                    ........
 
 @_ZTIi = external constant ptr
Index: llvm/test/CodeGen/Mips/micromips-gcc-except-table.ll
===================================================================
--- llvm/test/CodeGen/Mips/micromips-gcc-except-table.ll
+++ llvm/test/CodeGen/Mips/micromips-gcc-except-table.ll
@@ -1,7 +1,7 @@
 ; RUN: llc -mtriple=mips-linux-gnu -mcpu=mips32r2 -mattr=+micromips -O3 -filetype=obj < %s | llvm-objdump -s -j .gcc_except_table - | FileCheck %s
 
 ; CHECK: Contents of section .gcc_except_table:
-; CHECK-NEXT: 0000 ff9b1501 0c011100 00110e1f 011f1800
+; CHECK-NEXT: 0000 ff9b1501 0c001000 00100e1e 011e1800
 ; CHECK-NEXT: 0010 00010000 00000000
 
 @_ZTIi = external constant ptr
Index: llvm/test/CodeGen/Mips/micromips-b-range.ll
===================================================================
--- llvm/test/CodeGen/Mips/micromips-b-range.ll
+++ llvm/test/CodeGen/Mips/micromips-b-range.ll
@@ -13,7 +13,7 @@
 ; CHECK-NEXT:    1e:	fb fd 00 00 	sw	$ra, 0($sp)
 ; CHECK-NEXT:    22:	41 a1 00 01 	lui	$1, 1
 ; CHECK-NEXT:    26:	40 60 00 02 	bal	0x2e <foo+0x2e>
-; CHECK-NEXT:    2a:	30 21 04 69 	addiu	$1, $1, 1129
+; CHECK-NEXT:    2a:	30 21 04 68 	addiu	$1, $1, 1128
 ; CHECK-NEXT:    2e:	00 3f 09 50 	addu	$1, $ra, $1
 ; CHECK-NEXT:    32:	ff fd 00 00 	lw	$ra, 0($sp)
 ; CHECK-NEXT:    36:	00 01 0f 3c 	jr	$1
@@ -27,7 +27,7 @@
 ; CHECK-NEXT:    56:	fb fd 00 00 	sw	$ra, 0($sp)
 ; CHECK-NEXT:    5a:	41 a1 00 01 	lui	$1, 1
 ; CHECK-NEXT:    5e:	40 60 00 02 	bal	0x66 <foo+0x66>
-; CHECK-NEXT:    62:	30 21 04 5d 	addiu	$1, $1, 1117
+; CHECK-NEXT:    62:	30 21 04 5c 	addiu	$1, $1, 1116
 ; CHECK-NEXT:    66:	00 3f 09 50 	addu	$1, $ra, $1
 ; CHECK-NEXT:    6a:	ff fd 00 00 	lw	$ra, 0($sp)
 ; CHECK-NEXT:    6e:	00 01 0f 3c 	jr	$1
@@ -39,7 +39,7 @@
 ; CHECK-NEXT:    86:	fb fd 00 00 	sw	$ra, 0($sp)
 ; CHECK-NEXT:    8a:	41 a1 00 01 	lui	$1, 1
 ; CHECK-NEXT:    8e:	40 60 00 02 	bal	0x96 <foo+0x96>
-; CHECK-NEXT:    92:	30 21 04 2d 	addiu	$1, $1, 1069
+; CHECK-NEXT:    92:	30 21 04 2c 	addiu	$1, $1, 1068
 ; CHECK-NEXT:    96:	00 3f 09 50 	addu	$1, $ra, $1
 ; CHECK-NEXT:    9a:	ff fd 00 00 	lw	$ra, 0($sp)
 ; CHECK-NEXT:    9e:	00 01 0f 3c 	jr	$1
@@ -51,7 +51,7 @@
 ; CHECK-NEXT: 10476:	fb fd 00 00 	sw	$ra, 0($sp)
 ; CHECK-NEXT: 1047a:	41 a1 00 01 	lui	$1, 1
 ; CHECK-NEXT: 1047e:	40 60 00 02 	bal	0x10486 <foo+0x10486>
-; CHECK-NEXT: 10482:	30 21 04 01 	addiu	$1, $1, 1025
+; CHECK-NEXT: 10482:	30 21 04 00 	addiu	$1, $1, 1024
 ; CHECK-NEXT: 10486:	00 3f 09 50 	addu	$1, $ra, $1
 ; CHECK-NEXT: 1048a:	ff fd 00 00 	lw	$ra, 0($sp)
 ; CHECK-NEXT: 1048e:	00 01 0f 3c 	jr	$1
Index: llvm/lib/MC/MCExpr.cpp
===================================================================
--- llvm/lib/MC/MCExpr.cpp
+++ llvm/lib/MC/MCExpr.cpp
@@ -611,11 +611,6 @@
     if (Asm->isThumbFunc(&SA))
       Addend |= 1;
 
-    // If symbol is labeled as micromips, we set low-bit to ensure
-    // correct offset in .gcc_except_table
-    if (Asm->getBackend().isMicroMips(&SA))
-      Addend |= 1;
-
     // Clear the symbol expr pointers to indicate we have folded these
     // operands.
     A = B = nullptr;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157655.551008.patch
Type: text/x-patch
Size: 3835 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230817/0ef65b1e/attachment.bin>


More information about the llvm-commits mailing list