[PATCH] D6594: Fix for bug 8281 - Extremely slow assembling and disassembling of ptrtoint

Chenguang Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 15 17:20:37 PST 2021


wecing updated this revision to Diff 317122.
wecing added a comment.

Update implementation to use local cache and add unit tests.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D6594

Files:
  llvm/test/tools/llvm-as/slow-ptrtoint.ll


Index: llvm/test/tools/llvm-as/slow-ptrtoint.ll
===================================================================
--- llvm/test/tools/llvm-as/slow-ptrtoint.ll
+++ llvm/test/tools/llvm-as/slow-ptrtoint.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as %s -o -
+; RUN: llvm-as %s -o - | llvm-dis -o - | FileCheck %s
 
 %0 = type { %1, %1, %1, %1, %1, %1, %1, %1 }
 %1 = type { %2, %2, %2, %2, %2, %2, %2, %2 }
@@ -15,12 +15,16 @@
 %12 = type { %13, %13, %13, %13, %13, %13, %13, %13 }
 %13 = type { i32, i32 }
 
-define i64 @f() {
-  ; it would take a naive recursive implementation ~4 days
-  ; to constant fold the size
+; it would take a naive recursive implementation ~4 days
+; to constant fold the size of %0
+define i64 @f_i64() {
+; CHECK-LABEL: @f_i64
+; CHECK:         ret i64 mul (i64 ptrtoint (i32* getelementptr (i32, i32* null, i32 1) to i64), i64 1099511627776)
   ret i64 ptrtoint (%0* getelementptr (%0, %0* null, i32 1) to i64)
 }
 
-define i32 @f2() {
-  ret i32 ptrtoint (%0* getelementptr (%0, %0* null, i32 1) to i32)
+define i32 @f_i32() {
+; CHECK-LABEL: @f_i32
+; CHECK:         ret i32 mul (i32 ptrtoint (i32* getelementptr (i32, i32* null, i32 1) to i32), i32 -2147483648)
+  ret i32 ptrtoint (%3* getelementptr (%3, %3* null, i32 1) to i32)
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6594.317122.patch
Type: text/x-patch
Size: 1257 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210116/3b7ab958/attachment.bin>


More information about the llvm-commits mailing list