summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-02-17 20:12:52 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-02-17 20:12:52 +0000
commit132bea96ad7ad5b09e8426b7db18a63b12548542 (patch)
treebf64939a98be41851076555e5c995438fb940050 /clang/lib
parent1eb5cd9b746c2f56cd25711f823fd942bab3a161 (diff)
downloadbcm5719-llvm-132bea96ad7ad5b09e8426b7db18a63b12548542.tar.gz
bcm5719-llvm-132bea96ad7ad5b09e8426b7db18a63b12548542.zip
Don't emit optimization-specific intrinsic at -O0.
llvm-svn: 150838
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CGDeclCXX.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp
index 75bb7dedd90..d8ece58d6e5 100644
--- a/clang/lib/CodeGen/CGDeclCXX.cpp
+++ b/clang/lib/CodeGen/CGDeclCXX.cpp
@@ -104,6 +104,10 @@ static void EmitDeclDestroy(CodeGenFunction &CGF, const VarDecl &D,
/// Emit code to cause the variable at the given address to be considered as
/// constant from this point onwards.
static void EmitDeclInvariant(CodeGenFunction &CGF, llvm::Constant *Addr) {
+ // Don't emit the intrinsic if we're not optimizing.
+ if (!CGF.CGM.getCodeGenOpts().OptimizationLevel)
+ return;
+
// Grab the llvm.invariant.start intrinsic.
llvm::Intrinsic::ID InvStartID = llvm::Intrinsic::invariant_start;
llvm::Constant *InvariantStart = CGF.CGM.getIntrinsic(InvStartID);
OpenPOWER on IntegriCloud