GlobalIFunc: Make allowed constant expressions stricter
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Thu, 24 Nov 2022 02:23:47 +0000 (21:23 -0500)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Fri, 2 Dec 2022 20:20:57 +0000 (15:20 -0500)
commitf883e75497b610de81b3a6af106c976bb3c2bbb1
treec9feeddd6c11cb6437a732a644977ae068dd81c1
parent27387896cfe898e66f411ff26b8e34698a8f92fc
GlobalIFunc: Make allowed constant expressions stricter

This was allowing getelementptr with offsets, which doesn't make
sense. My initial attempt to use stripPointerCasts broke a few tests
involving aliases; add a new targeted verifier test for aliases.

This also provides the fix from D138537 for free, and also adds
support for addrspacecast (D138538) for free. Merge the tests in from
those.

I'm not really sure why findBaseObject exists; it seems redundant with
stripPointerCasts* (I'm also not really sure why getelementptrs are
allowed off of functions).
llvm/lib/IR/Globals.cpp
llvm/test/Assembler/ifunc-stripPointerCastsAndAliases.ll [new file with mode: 0644]
llvm/test/Verifier/ifunc-opaque.ll [new file with mode: 0644]