[llvm] [StructuralHash] Global Variable (PR #118412)

Kyungwoo Lee via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 2 22:36:54 PST 2024


================
@@ -0,0 +1,91 @@
+; This test verifies that global variables are hashed based on their initial contents,
+; allowing them to be merged even if they appear different due to their names.
+; Now they become identical functions that can be merged without creating a paramter.
+
+; RUN: rm -rf %t && split-file %s %t
+
+; RUN: llc -mtriple=arm64-apple-darwin -enable-global-merge-func=true -global-merging-skip-no-params=false < %t/string.ll | FileCheck %s
+; RUN: llc -mtriple=arm64-apple-darwin -enable-global-merge-func=true -global-merging-skip-no-params=false < %t/ns-const.ll | FileCheck %s
+; RUN: llc -mtriple=arm64-apple-darwin -enable-global-merge-func=true -global-merging-skip-no-params=false < %t/objc-ref.ll | FileCheck %s
+
+; CHECK: _f1.Tgm
+; CHECK: _f2.Tgm
+
+;--- string.ll
+
+ at .str = private unnamed_addr constant [6 x i8] c"hello\00", align 1
+ at .str.1 = private unnamed_addr constant [6 x i8] c"hello\00", align 1
----------------
kyulee-com wrote:

Added a failing case.

https://github.com/llvm/llvm-project/pull/118412


More information about the llvm-commits mailing list