[llvm-commits] [llvm] r37857 - /llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp
Owen Anderson
resistor at mac.com
Tue Jul 3 12:01:42 PDT 2007
Author: resistor
Date: Tue Jul 3 14:01:42 2007
New Revision: 37857
URL: http://llvm.org/viewvc/llvm-project?rev=37857&view=rev
Log:
Make the unary operator case a bit faster, since casts are the only kind of unary operation.
Modified:
llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp?rev=37857&r1=37856&r2=37857&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp Tue Jul 3 14:01:42 2007
@@ -630,9 +630,7 @@
return 0;
// Unary Operations
- if (isa<CastInst>(V)) {
- User* U = cast<User>(V);
-
+ if (CastInst* U = dyn_cast<CastInst>(V)) {
Value* newOp1 = 0;
if (isa<Instruction>(U->getOperand(0)))
newOp1 = phi_translate(U->getOperand(0), pred, succ);
@@ -817,9 +815,7 @@
Value* v = worklist[i];
// Handle unary ops
- if (isa<CastInst>(v)) {
- User* U = cast<User>(v);
-
+ if (CastInst* U = dyn_cast<CastInst>(v)) {
bool lhsValid = !isa<Instruction>(U->getOperand(0));
lhsValid |= presentInSet.test(VN.lookup(U->getOperand(0)));
if (lhsValid)
@@ -892,8 +888,7 @@
Value* e = stack.back();
// Handle unary ops
- if (isa<CastInst>(e)) {
- User* U = cast<User>(e);
+ if (CastInst* U = dyn_cast<CastInst>(e)) {
Value* l = find_leader(set, VN.lookup(U->getOperand(0)));
if (l != 0 && isa<Instruction>(l) &&
@@ -1054,8 +1049,7 @@
currPhis.insert(p);
// Handle unary ops
- } else if (isa<CastInst>(I)) {
- User* U = cast<User>(I);
+ } else if (CastInst* U = dyn_cast<CastInst>(I)) {
Value* leftValue = U->getOperand(0);
unsigned num = VN.lookup_or_add(U);
More information about the llvm-commits
mailing list