[PATCH] D12851: [GlobalOpt] Sort members of llvm.used deterministically

Sean Silva via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 12:03:53 PDT 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL248728: [GlobalOpt] Sort members of llvm.used deterministically (authored by silvas).

Changed prior to commit:
  http://reviews.llvm.org/D12851?vs=34699&id=35896#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D12851

Files:
  llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
  llvm/trunk/test/Transforms/GlobalOpt/alias-used.ll

Index: llvm/trunk/test/Transforms/GlobalOpt/alias-used.ll
===================================================================
--- llvm/trunk/test/Transforms/GlobalOpt/alias-used.ll
+++ llvm/trunk/test/Transforms/GlobalOpt/alias-used.ll
@@ -7,7 +7,7 @@
 @ia = internal alias i8, i8* @i
 
 @llvm.used = appending global [3 x i8*] [i8* bitcast (void ()* @fa to i8*), i8* bitcast (void ()* @f to i8*), i8* @ca], section "llvm.metadata"
-; CHECK-DAG: @llvm.used = appending global [3 x i8*] [i8* bitcast (void ()* @fa to i8*), i8* bitcast (void ()* @f to i8*), i8* @ca], section "llvm.metadata"
+; CHECK-DAG: @llvm.used = appending global [3 x i8*] [i8* @ca, i8* bitcast (void ()* @fa to i8*), i8* bitcast (void ()* @f to i8*)], section "llvm.metadata"
 
 @llvm.compiler.used = appending global [4 x i8*] [i8* bitcast (void ()* @fa3 to i8*), i8* bitcast (void ()* @fa to i8*), i8* @ia, i8* @i], section "llvm.metadata"
 ; CHECK-DAG: @llvm.compiler.used = appending global [2 x i8*] [i8* bitcast (void ()* @fa3 to i8*), i8* @ia], section "llvm.metadata"
Index: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
===================================================================
--- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
+++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
@@ -2712,7 +2712,8 @@
 }
 
 static int compareNames(Constant *const *A, Constant *const *B) {
-  return (*A)->getName().compare((*B)->getName());
+  return (*A)->stripPointerCasts()->getName().compare(
+      (*B)->stripPointerCasts()->getName());
 }
 
 static void setUsedInitializer(GlobalVariable &V,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12851.35896.patch
Type: text/x-patch
Size: 1567 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150928/e43f4efc/attachment.bin>


More information about the llvm-commits mailing list