[PATCH] D88261: [CodeGen] Do not call `emitGlobalConstantLargeInt` for constant requires 8 bytes to store

Simon Atanasyan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 25 22:59:27 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGc6c5629f2fb4: [CodeGen] Do not call `emitGlobalConstantLargeInt` for constant requires 8… (authored by atanasyan).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88261

Files:
  llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  llvm/test/CodeGen/Mips/emit-big-cst.ll


Index: llvm/test/CodeGen/Mips/emit-big-cst.ll
===================================================================
--- llvm/test/CodeGen/Mips/emit-big-cst.ll
+++ llvm/test/CodeGen/Mips/emit-big-cst.ll
@@ -16,6 +16,14 @@
 ; LE-NEXT: .space 5
 ; LE-NEXT: .size bigCst, 16
 
+; BE-LABEL: notSoBigCst:
+; BE-NEXT:  .8byte  72057594037927935
+; BE-NEXT:  .size   notSoBigCst, 8
+
+; LE-LABEL: notSoBigCst:
+; LE-NEXT:  .8byte  72057594037927935
+; LE-NEXT:  .size   notSoBigCst, 8
+
 ; BE-LABEL: smallCst:
 ; BE-NEXT: .2byte 4386
 ; BE-NEXT: .byte 51
@@ -38,4 +46,14 @@
   ret void
 }
 
+ at notSoBigCst = internal constant i57 72057594037927935
+
+define void @accessNotSoBig(i64* %storage) {
+  %addr = bitcast i64* %storage to i57*
+  %bigLoadedCst = load volatile i57, i57* @notSoBigCst
+  %tmp = add i57 %bigLoadedCst, 1
+  store i57 %tmp, i57* %addr
+  ret void
+}
+
 @smallCst = internal constant i24 1122867
Index: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -2800,7 +2800,7 @@
   if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
     const uint64_t StoreSize = DL.getTypeStoreSize(CV->getType());
 
-    if (StoreSize < 8) {
+    if (StoreSize <= 8) {
       if (AP.isVerbose())
         AP.OutStreamer->GetCommentOS() << format("0x%" PRIx64 "\n",
                                                  CI->getZExtValue());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88261.294480.patch
Type: text/x-patch
Size: 1491 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200926/f954baf2/attachment.bin>


More information about the llvm-commits mailing list