Reapply r374743 with a fix for the ocaml binding
authorJoerg Sonnenberger <joerg@bec.de>
Mon, 14 Oct 2019 16:15:14 +0000 (16:15 +0000)
committerJoerg Sonnenberger <joerg@bec.de>
Mon, 14 Oct 2019 16:15:14 +0000 (16:15 +0000)
commit9681ea9560a00038a29ed368dfa32104b0597b26
treecc2028197f3060841a26f49315e48c9affeb3ca1
parentee86804cf1bc7f9d9935261231b95e8f30dd7c03
Reapply r374743 with a fix for the ocaml binding

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: 374784
39 files changed:
llvm/bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.ml
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