mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-25 04:39:44 +00:00
LowerBitSets: Give names to aliases of unnamed bitset element objects.
It is valid for globals to be unnamed, but aliases must have a name. To avoid creating invalid IR, we need to assign names to any aliases we create that point to unnamed objects that have been moved into combined globals. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239590 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e0de59ac91
commit
ba74b27ed1
@ -556,8 +556,9 @@ void LowerBitSets::buildBitSetsFromGlobals(
|
||||
} else {
|
||||
GlobalAlias *GAlias =
|
||||
GlobalAlias::create(Globals[I]->getType(), Globals[I]->getLinkage(),
|
||||
"", CombinedGlobalElemPtr, M);
|
||||
GAlias->takeName(Globals[I]);
|
||||
"data", CombinedGlobalElemPtr, M);
|
||||
if (Globals[I]->hasName())
|
||||
GAlias->takeName(Globals[I]);
|
||||
Globals[I]->replaceAllUsesWith(GAlias);
|
||||
}
|
||||
Globals[I]->eraseFromParent();
|
||||
|
19
test/Transforms/LowerBitSets/unnamed.ll
Normal file
19
test/Transforms/LowerBitSets/unnamed.ll
Normal file
@ -0,0 +1,19 @@
|
||||
; RUN: opt -S -lowerbitsets < %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-p:32:32"
|
||||
|
||||
; CHECK: @data ={{.*}} alias
|
||||
@0 = constant i32 1
|
||||
@1 = constant [2 x i32] [i32 2, i32 3]
|
||||
|
||||
!0 = !{!"bitset1", i32* @0, i32 0}
|
||||
!1 = !{!"bitset1", [2 x i32]* @1, i32 4}
|
||||
|
||||
!llvm.bitsets = !{ !0, !1 }
|
||||
|
||||
declare i1 @llvm.bitset.test(i8* %ptr, metadata %bitset) nounwind readnone
|
||||
|
||||
define i1 @foo(i8* %p) {
|
||||
%x = call i1 @llvm.bitset.test(i8* %p, metadata !"bitset1")
|
||||
ret i1 %x
|
||||
}
|
Loading…
Reference in New Issue
Block a user