mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +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:
parent
5a4700cb8f
commit
3db4fdda61
@ -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))
|
||||
|
14
test/ExecutionEngine/Interpreter/alias.ll
Normal file
14
test/ExecutionEngine/Interpreter/alias.ll
Normal 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
|
||||
}
|
Loading…
Reference in New Issue
Block a user