[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Chris Lattner
lattner at cs.uiuc.edu
Fri Jan 13 12:11:16 PST 2006
Changes in directory llvm/lib/Transforms/Scalar:
InstructionCombining.cpp updated: 1.411 -> 1.412
---
Log message:
Simplify this a tiny bit by using the new IntrinsicInst functionality.
---
Diffs of the changes: (+12 -7)
InstructionCombining.cpp | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.411 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.412
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.411 Fri Jan 6 19:32:28 2006
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Fri Jan 13 14:11:04 2006
@@ -4620,12 +4620,17 @@
}
-// CallInst simplification
-//
+/// visitCallInst - CallInst simplification. This mostly only handles folding
+/// of intrinsic instructions. For normal calls, it allows visitCallSite to do
+/// the heavy lifting.
+///
Instruction *InstCombiner::visitCallInst(CallInst &CI) {
+ IntrinsicInst *II = dyn_cast<IntrinsicInst>(&CI);
+ if (!II) return visitCallSite(&CI);
+
// Intrinsics cannot occur in an invoke, so handle them here instead of in
// visitCallSite.
- if (MemIntrinsic *MI = dyn_cast<MemIntrinsic>(&CI)) {
+ if (MemIntrinsic *MI = dyn_cast<MemIntrinsic>(II)) {
bool Changed = false;
// memmove/cpy/set of zero bytes is a noop.
@@ -4645,7 +4650,7 @@
// If we have a memmove and the source operation is a constant global,
// then the source and dest pointers can't alias, so we can change this
// into a call to memcpy.
- if (MemMoveInst *MMI = dyn_cast<MemMoveInst>(MI))
+ if (MemMoveInst *MMI = dyn_cast<MemMoveInst>(II))
if (GlobalVariable *GVSrc = dyn_cast<GlobalVariable>(MMI->getSource()))
if (GVSrc->isConstant()) {
Module *M = CI.getParent()->getParent()->getParent();
@@ -4655,8 +4660,8 @@
Changed = true;
}
- if (Changed) return &CI;
- } else if (DbgStopPointInst *SPI = dyn_cast<DbgStopPointInst>(&CI)) {
+ if (Changed) return II;
+ } else if (DbgStopPointInst *SPI = dyn_cast<DbgStopPointInst>(II)) {
// If this stoppoint is at the same source location as the previous
// stoppoint in the chain, it is not needed.
if (DbgStopPointInst *PrevSPI =
@@ -4668,7 +4673,7 @@
}
}
- return visitCallSite(&CI);
+ return visitCallSite(II);
}
// InvokeInst simplification
More information about the llvm-commits
mailing list