[SimplifyLibCalls][IRBuilder] Accept any IRBuilder in SimplifyLibCalls
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 18 Feb 2020 21:20:55 +0000 (22:20 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 21 Feb 2020 17:26:05 +0000 (18:26 +0100)
commita8db806d52ce02ddca179b811da164023316d4b9
tree6a7f772f4cc560d705c0b69536f1a72be8bcebf6
parent8c70a2597f53457efc8eb2798c1d1056bb105ec3
[SimplifyLibCalls][IRBuilder] Accept any IRBuilder in SimplifyLibCalls

This changes the SimplifyLibCalls utility to accept an IRBuilderBase,
which allows us to pass through the IRBuilder used by InstCombine.
This will ensure that new instructions get added to the worklist.
The annotated test-case drops from 4 to 2 InstCombine iterations thanks
to this.

To achieve this, I'm adding an IRBuilderBase::OperandBundlesGuard,
which is basically the same as the existing InsertPointGuard and
FastMathFlagsGuard, but for operand bundles. Also add a
setDefaultOperandBundles() method so these can be set outside the
constructor.

Differential Revision: https://reviews.llvm.org/D74792
llvm/include/llvm/IR/IRBuilder.h
llvm/include/llvm/Transforms/Utils/SimplifyLibCalls.h
llvm/lib/CodeGen/CodeGenPrepare.cpp
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
llvm/test/Transforms/InstCombine/simplify-libcalls.ll