summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine
diff options
context:
space:
mode:
authorMichael Ilseman <milseman@apple.com>2013-02-07 23:01:35 +0000
committerMichael Ilseman <milseman@apple.com>2013-02-07 23:01:35 +0000
commit6092dc54550217336e9a13eb0f7121984c1251cb (patch)
tree3eaf65ce63225a721b16edc75beaef464ca9702f /llvm/lib/Transforms/InstCombine
parent4bedb499eaa00fa6bec341a2f8eb1a66a3aa6d63 (diff)
downloadbcm5719-llvm-6092dc54550217336e9a13eb0f7121984c1251cb.tar.gz
bcm5719-llvm-6092dc54550217336e9a13eb0f7121984c1251cb.zip
Have InstCombine call SipmlifyCall when handling calls. Test case included.
llvm-svn: 174675
Diffstat (limited to 'llvm/lib/Transforms/InstCombine')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index 64cd1bd2789..cb9ba44600a 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/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);
OpenPOWER on IntegriCloud