[Bug 56290] Stop assuming that aliasee are functions


By https://github.com/llvm/llvm-project/issues/56290, I can see that in many places, we assumed that aliasee can only be functions.

I figured out that the following IR can actually trigger several bugs across IPO/LTO/Analysis/Transforms modules.

; RUN: opt -module-summary -o %t.bc %s
; RUN: llvm-lto2 run %t.bc -r %t.bc,foo,px -r %t.bc,bar,px -r %t.bc,baz,px -r %t.bc,qux,px -r %t.bc,grault,px -o %t2
; RUN: llvm-nm %t2.1 | FileCheck %s
; CHECK: i bar
; CHECK: i baz
; CHECK: i foo
; CHECK: t foo_resolver
; CHECK: i grault
; CHECK: i quuz
; CHECK: i qux

target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@foo = ifunc i32 (i32), i32 (i32)* ()* @foo_resolver

define internal i32 (i32)* @foo_resolver() {
  ret i32 (i32)* null

@bar = alias i32 (i32), i32 (i32)* @foo
@baz = weak alias i32 (i32), i32 (i32)* @foo
@qux = alias i32 (i32), i32 (i32)* @bar

@quux = internal alias i32 (i32)* (), i32 (i32)* ()* @foo_resolver
@quuz = internal ifunc i32 (i32), i32 (i32)* ()* @quux
@corge = internal alias i32 (i32), i32 (i32)* @quuz
@grault = alias i32 (i32), i32 (i32)* @corge

; no crash

My attempt to address the problem is summarized at ⚙ D129009 [ThinLTO] Support aliased GlobalIFunc. But as I am really new to LLVM, I don’t know if there is any other place I should amend for this issue. Could you please kindly remind me if there is something missing? Thanks in advance!