diff options
author | Michael Ilseman <milseman@apple.com> | 2013-02-07 23:01:35 +0000 |
---|---|---|
committer | Michael Ilseman <milseman@apple.com> | 2013-02-07 23:01:35 +0000 |
commit | 3854a5d90fee52af1065edbed34521fff6cdc18d (patch) | |
tree | 23ce60643fdcafc05f97944a86e0e928c5a11702 /lib/Transforms | |
parent | 4fae15e664290a974d44145f4a178ec06e8538e9 (diff) | |
download | external_llvm-3854a5d90fee52af1065edbed34521fff6cdc18d.zip external_llvm-3854a5d90fee52af1065edbed34521fff6cdc18d.tar.gz external_llvm-3854a5d90fee52af1065edbed34521fff6cdc18d.tar.bz2 |
Have InstCombine call SipmlifyCall when handling calls. Test case included.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174675 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/InstCombine/InstCombineCalls.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineCalls.cpp b/lib/Transforms/InstCombine/InstCombineCalls.cpp index 64cd1bd..cb9ba44 100644 --- a/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -13,6 +13,7 @@ #include "InstCombine.h" #include "llvm/ADT/Statistic.h" +#include "llvm/Analysis/InstructionSimplify.h" #include "llvm/Analysis/MemoryBuiltins.h" #include "llvm/IR/DataLayout.h" #include "llvm/Support/CallSite.h" @@ -210,6 +211,11 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { return &CI; } + CallSite CS(&CI); + if (Value *V = SimplifyCall(CS.getCalledValue(), CS.arg_begin(), CS.arg_end(), + TD)) + return ReplaceInstUsesWith(CI, V); + IntrinsicInst *II = dyn_cast<IntrinsicInst>(&CI); if (!II) return visitCallSite(&CI); |