Add a pass to lower is.constant and objectsize intrinsics
authorJoerg Sonnenberger <joerg@bec.de>
Sun, 13 Oct 2019 23:00:15 +0000 (23:00 +0000)
committerJoerg Sonnenberger <joerg@bec.de>
Sun, 13 Oct 2019 23:00:15 +0000 (23:00 +0000)
commite4300c392de28b659749d77b415b4903786caa0c
treee2932a42e822bdc97da8cc30e6d80dd87c0518ec
parent529f4ed401ea9761461fb42b1efa552c320c40fb
Add a pass to lower is.constant and objectsize intrinsics

This pass lowers is.constant and objectsize intrinsics not simplified by
earlier constant folding, i.e. if the object given is not constant or if
not using the optimized pass chain. The result is recursively simplified
and constant conditionals are pruned, so that dead blocks are removed
even for -O0. This allows inline asm blocks with operand constraints to
work all the time.

The new pass replaces the existing lowering in the codegen-prepare pass
and fallbacks in SDAG/GlobalISEL and FastISel. The latter now assert
on the intrinsics.

Differential Revision: https://reviews.llvm.org/D65280

llvm-svn: 374743
38 files changed:
llvm/bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.mli
llvm/bindings/ocaml/transforms/scalar_opts/scalar_opts_ocaml.c
llvm/include/llvm-c/Transforms/Scalar.h
llvm/include/llvm/InitializePasses.h
llvm/include/llvm/LinkAllPasses.h
llvm/include/llvm/Transforms/Scalar.h
llvm/include/llvm/Transforms/Scalar/LowerConstantIntrinsics.h [new file with mode: 0644]
llvm/lib/CodeGen/CodeGenPrepare.cpp
llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/lib/CodeGen/TargetPassConfig.cpp
llvm/lib/Passes/PassBuilder.cpp
llvm/lib/Passes/PassRegistry.def
llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
llvm/lib/Transforms/Scalar/CMakeLists.txt
llvm/lib/Transforms/Scalar/LowerConstantIntrinsics.cpp [new file with mode: 0644]
llvm/lib/Transforms/Scalar/Scalar.cpp
llvm/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
llvm/test/CodeGen/AArch64/O0-pipeline.ll
llvm/test/CodeGen/AArch64/O3-pipeline.ll
llvm/test/CodeGen/ARM/O3-pipeline.ll
llvm/test/CodeGen/Generic/is-constant.ll [deleted file]
llvm/test/CodeGen/X86/O0-pipeline.ll
llvm/test/CodeGen/X86/O3-pipeline.ll
llvm/test/CodeGen/X86/is-constant.ll [deleted file]
llvm/test/CodeGen/X86/object-size.ll [deleted file]
llvm/test/Other/new-pm-defaults.ll
llvm/test/Other/new-pm-thinlto-defaults.ll
llvm/test/Other/opt-O2-pipeline.ll
llvm/test/Other/opt-O3-pipeline.ll
llvm/test/Other/opt-Os-pipeline.ll
llvm/test/Transforms/CodeGenPrepare/X86/overflow-intrinsics.ll
llvm/test/Transforms/CodeGenPrepare/builtin-condition.ll [deleted file]
llvm/test/Transforms/LowerConstantIntrinsics/constant-intrinsics.ll [new file with mode: 0644]
llvm/test/Transforms/LowerConstantIntrinsics/crash-on-large-allocas.ll [moved from llvm/test/Transforms/CodeGenPrepare/crash-on-large-allocas.ll with 87% similarity]
llvm/test/Transforms/LowerConstantIntrinsics/objectsize_basic.ll [moved from llvm/test/Transforms/CodeGenPrepare/basic.ll with 94% similarity]
llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn