summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGBuiltin.cpp
diff options
context:
space:
mode:
authorDavid Chisnall <csdavec@swan.ac.uk>2012-01-06 12:20:19 +0000
committerDavid Chisnall <csdavec@swan.ac.uk>2012-01-06 12:20:19 +0000
commit9217435a335eb78b141d57f5d7bb1bc14028742d (patch)
tree1b2035c6fa0059755ce0020f064bb1ce0d1c5368 /clang/lib/CodeGen/CGBuiltin.cpp
parentd8e2572909508aad6c9c2d730809e0de226513b3 (diff)
downloadbcm5719-llvm-9217435a335eb78b141d57f5d7bb1bc14028742d.tar.gz
bcm5719-llvm-9217435a335eb78b141d57f5d7bb1bc14028742d.zip
If we are compiling with -fno-builtin then don't do constant folding of
builtins. This fixes PR11711. llvm-svn: 147655
Diffstat (limited to 'clang/lib/CodeGen/CGBuiltin.cpp')
-rw-r--r--clang/lib/CodeGen/CGBuiltin.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 3e5a6772ebb..f462ee62ad6 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -175,7 +175,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
unsigned BuiltinID, const CallExpr *E) {
// See if we can constant fold this builtin. If so, don't emit it at all.
Expr::EvalResult Result;
- if (E->EvaluateAsRValue(Result, CGM.getContext()) &&
+ if (!getContext().getLangOptions().NoBuiltin &&
+ E->EvaluateAsRValue(Result, CGM.getContext()) &&
!Result.hasSideEffects()) {
if (Result.Val.isInt())
return RValue::get(llvm::ConstantInt::get(getLLVMContext(),
OpenPOWER on IntegriCloud