diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-03-08 22:44:50 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-03-08 22:44:50 +0000 |
commit | f463519f0c1a0c20f6a0d1c61814f0b1b4183a10 (patch) | |
tree | c7ce8c258e1f5b4fb4c087cf8bc9ada05a6041b5 /lib/CodeGen/CGStmt.cpp | |
parent | 1dda0966cc880e12302298fb005bacb5fb294b93 (diff) |
Notes
Diffstat (limited to 'lib/CodeGen/CGStmt.cpp')
-rw-r--r-- | lib/CodeGen/CGStmt.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp index 0242b48659d1..b2b32759b6f7 100644 --- a/lib/CodeGen/CGStmt.cpp +++ b/lib/CodeGen/CGStmt.cpp @@ -1821,8 +1821,15 @@ llvm::Value* CodeGenFunction::EmitAsmInput( // (immediate or symbolic), try to emit it as such. if (!Info.allowsRegister() && !Info.allowsMemory()) { if (Info.requiresImmediateConstant()) { - llvm::APSInt AsmConst = InputExpr->EvaluateKnownConstInt(getContext()); - return llvm::ConstantInt::get(getLLVMContext(), AsmConst); + Expr::EvalResult EVResult; + InputExpr->EvaluateAsRValue(EVResult, getContext(), true); + + llvm::APSInt IntResult; + if (!EVResult.Val.toIntegralConstant(IntResult, InputExpr->getType(), + getContext())) + llvm_unreachable("Invalid immediate constant!"); + + return llvm::ConstantInt::get(getLLVMContext(), IntResult); } Expr::EvalResult Result; |