summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff options
context:
space:
mode:
authorQuentin Colombet <quentin.colombet@gmail.com>2018-10-30 20:51:04 +0000
committerQuentin Colombet <quentin.colombet@gmail.com>2018-10-30 20:51:04 +0000
commit900678227c3cc42bc01c82eb4f814524e6b79bd0 (patch)
tree9020f3e05bfc0ad6d57d685078c6855a762c5ecf /llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
parent93a64efcd3358e85ca24da11d6fa765d01dd6e45 (diff)
downloadbcm5719-llvm-900678227c3cc42bc01c82eb4f814524e6b79bd0.tar.gz
bcm5719-llvm-900678227c3cc42bc01c82eb4f814524e6b79bd0.zip
[InstCombine] Teach the move free before null test opti how to deal with noop casts
InstCombine features an optimization that essentially replaces: if (a) free(a) into: free(a) Right now, this optimization is gated by the minsize attribute and therefore we only perform it if we can prove that we are going to be able to eliminate the branch and the destination block. However when casts are involved the optimization would fail to apply, because the optimization was not smart enough to realize that it is possible to also move the casts away from the destination block and that is harmless to the performance since they are just noops. E.g., foo(int *a) if (a) free((char*)a) Wouldn't be optimized by instcombine, because - We would refuse to hoist the `bitcast i32* %a to i8` in the source block - We would fail to see that `bitcast i32* %a to i8` and %a are the same value. This patch fixes both these problems: - It teaches the pattern matching of the comparison how to look through casts. - It checks that whether the additional instruction in the destination block can be hoisted and are harmless performance-wise. - It hoists all the code of the destination block in the source block. Differential Revision: D53356 llvm-svn: 345644
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud