1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

Add handling for GlobalAliases in ExecutionEngine::getConstantValue.

Patch by Brad Moody. Thanks Brad!

https://reviews.llvm.org/D42160

llvm-svn: 333217
This commit is contained in:
Lang Hames 2018-05-24 19:07:34 +00:00
parent 5a4700cb8f
commit 3db4fdda61
2 changed files with 17 additions and 0 deletions

View File

@ -903,6 +903,9 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
Result.IntVal = cast<ConstantInt>(C)->getValue();
break;
case Type::PointerTyID:
while (auto *A = dyn_cast<GlobalAlias>(C)) {
C = A->getAliasee();
}
if (isa<ConstantPointerNull>(C))
Result.PointerVal = nullptr;
else if (const Function *F = dyn_cast<Function>(C))

View File

@ -0,0 +1,14 @@
; RUN: %lli -force-interpreter %s
define i32 @func() {
entry:
ret i32 0
}
@alias = alias i32 (), i32 ()* @func
define i32 @main() {
entry:
%call = call i32 @alias()
ret i32 %call
}