summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorJoerg Sonnenberger <joerg@bec.de>2019-10-13 22:33:46 +0000
committerJoerg Sonnenberger <joerg@bec.de>2019-10-13 22:33:46 +0000
commit529f4ed401ea9761461fb42b1efa552c320c40fb (patch)
tree2d97732ca35e404a576dd951125107f6e1cb9d07 /clang/lib
parentf79716774a037d5c9ab41497227394994a5346a7 (diff)
downloadbcm5719-llvm-529f4ed401ea9761461fb42b1efa552c320c40fb.tar.gz
bcm5719-llvm-529f4ed401ea9761461fb42b1efa552c320c40fb.zip
Improve __builtin_constant_p lowering
__builtin_constant_p used to be short-cut evaluated to false when building with -O0. This is undesirable as it means that constant folding in the front-end can give different results than folding in the back-end. It can also create conditional branches on constant conditions that don't get folded away. With the pending improvements to the llvm.is.constant handling on the LLVM side, the short-cut is no longer useful. Adjust various codegen tests to not depend on the short-cut or the backend optimisations. Differential Revision: https://reviews.llvm.org/D67638 llvm-svn: 374742
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CGBuiltin.cpp4
1 files changed, 0 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index ddff595987b..2ccd16da256 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -2101,10 +2101,6 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
case Builtin::BI__builtin_constant_p: {
llvm::Type *ResultType = ConvertType(E->getType());
- if (CGM.getCodeGenOpts().OptimizationLevel == 0)
- // At -O0, we don't perform inlining, so we don't need to delay the
- // processing.
- return RValue::get(ConstantInt::get(ResultType, 0));
const Expr *Arg = E->getArg(0);
QualType ArgType = Arg->getType();
OpenPOWER on IntegriCloud