[llvm-commits] [llvm] r85316 - in /llvm/trunk: include/llvm/Bitcode/LLVMBitCodes.h lib/Analysis/InlineCost.cpp lib/Analysis/SparsePropagation.cpp
Chris Lattner
sabre at nondot.org
Tue Oct 27 14:27:42 PDT 2009
Author: lattner
Date: Tue Oct 27 16:27:42 2009
New Revision: 85316
URL: http://llvm.org/viewvc/llvm-project?rev=85316&view=rev
Log:
Random updates to passes for indbr, I need blockaddress before I can do much more.
Modified:
llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h
llvm/trunk/lib/Analysis/InlineCost.cpp
llvm/trunk/lib/Analysis/SparsePropagation.cpp
Modified: llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h?rev=85316&r1=85315&r2=85316&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h (original)
+++ llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h Tue Oct 27 16:27:42 2009
@@ -209,7 +209,7 @@
FUNC_CODE_INST_RET = 10, // RET: [opty,opval<both optional>]
FUNC_CODE_INST_BR = 11, // BR: [bb#, bb#, cond] or [bb#]
- FUNC_CODE_INST_SWITCH = 12, // SWITCH: [opty, operands...]
+ FUNC_CODE_INST_SWITCH = 12, // SWITCH: [opty, op0, op1, ...]
FUNC_CODE_INST_INVOKE = 13, // INVOKE: [attr, fnty, op0,op1, ...]
FUNC_CODE_INST_UNWIND = 14, // UNWIND
FUNC_CODE_INST_UNREACHABLE = 15, // UNREACHABLE
@@ -237,7 +237,7 @@
// new select on i1 or [N x i1]
FUNC_CODE_INST_VSELECT = 29, // VSELECT: [ty,opval,opval,predty,pred]
FUNC_CODE_INST_INBOUNDS_GEP= 30, // INBOUNDS_GEP: [n x operands]
- FUNC_CODE_INST_INDBR = 31 // INDBR: [opty, operands...]
+ FUNC_CODE_INST_INDBR = 31 // INDBR: [opty, op0, op1, ...]
};
} // End bitc namespace
} // End llvm namespace
Modified: llvm/trunk/lib/Analysis/InlineCost.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InlineCost.cpp?rev=85316&r1=85315&r2=85316&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/InlineCost.cpp (original)
+++ llvm/trunk/lib/Analysis/InlineCost.cpp Tue Oct 27 16:27:42 2009
@@ -31,6 +31,9 @@
// Eliminating a switch is a big win, proportional to the number of edges
// deleted.
Reduction += (SI->getNumSuccessors()-1) * 40;
+ else if (isa<IndBrInst>(*UI))
+ // Eliminating an indirect branch is a big win.
+ Reduction += 200;
else if (CallInst *CI = dyn_cast<CallInst>(*UI)) {
// Turning an indirect call into a direct call is a BIG win
Reduction += CI->getCalledValue() == V ? 500 : 0;
Modified: llvm/trunk/lib/Analysis/SparsePropagation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/SparsePropagation.cpp?rev=85316&r1=85315&r2=85316&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/SparsePropagation.cpp (original)
+++ llvm/trunk/lib/Analysis/SparsePropagation.cpp Tue Oct 27 16:27:42 2009
@@ -166,6 +166,11 @@
return;
}
+ if (IndBrInst *IBI = dyn_cast<IndBrInst>(TI)) {
+ Succs.assign(Succs.size(), true);
+ return;
+ }
+
SwitchInst &SI = cast<SwitchInst>(TI);
LatticeVal SCValue;
if (AggressiveUndef)
More information about the llvm-commits
mailing list