[CodeGenPrepare] limit overflow intrinsic matching to a single basic block
authorSanjay Patel <spatel@rotateright.com>
Fri, 3 May 2019 13:09:18 +0000 (13:09 +0000)
committerSanjay Patel <spatel@rotateright.com>
Fri, 3 May 2019 13:09:18 +0000 (13:09 +0000)
commit8ff072e48eceee35ff105d5d47853a9307302293
treefd0d688c7b777abc105aed1840931e622a7c4389
parentfd75ee9154d25a7ac4b806a193ef7ad846703c0c
[CodeGenPrepare] limit overflow intrinsic matching to a single basic block

Using/updating a dominator tree to match math overflow patterns may be very
expensive in compile-time (because of the way CGP uses a DT), so just handle
the single-block case.

Also, we were restarting the iterator loops when doing the overflow intrinsic
transforms by marking the dominator tree for update. That was done to prevent
iterating over a removed instruction. But we can postpone the deletion using
the existing "RemovedInsts" structure, and that means we don't need to update
the DT.

See post-commit thread for rL354298 for more details:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20190422/646276.html

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

llvm-svn: 359879
llvm/lib/CodeGen/CodeGenPrepare.cpp
llvm/test/CodeGen/X86/cgp-usubo.ll
llvm/test/Transforms/CodeGenPrepare/X86/optimizeSelect-DT.ll
llvm/test/Transforms/CodeGenPrepare/X86/overflow-intrinsics.ll