[llvm-commits] [llvm] r85680 - in /llvm/trunk/lib/Transforms: IPO/GlobalOpt.cpp Utils/ValueMapper.cpp
Chris Lattner
sabre at nondot.org
Sat Oct 31 13:13:24 PDT 2009
Author: lattner
Date: Sat Oct 31 15:13:24 2009
New Revision: 85680
URL: http://llvm.org/viewvc/llvm-project?rev=85680&view=rev
Log:
adjust a couple xforms to work with null bb's in BlockAddress.
Modified:
llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp
Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=85680&r1=85679&r2=85680&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Sat Oct 31 15:13:24 2009
@@ -2345,8 +2345,7 @@
Value *Val = getVal(Values, IBI->getAddress())->stripPointerCasts();
if (BlockAddress *BA = dyn_cast<BlockAddress>(Val))
NewBB = BA->getBasicBlock();
- else
- return false; // Cannot determine.
+ if (NewBB == 0) return false; // Cannot determine.
} else if (ReturnInst *RI = dyn_cast<ReturnInst>(CurInst)) {
if (RI->getNumOperands())
RetVal = getVal(Values, RI->getOperand(0));
Modified: llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp?rev=85680&r1=85679&r2=85680&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp Sat Oct 31 15:13:24 2009
@@ -113,8 +113,13 @@
if (BlockAddress *BA = dyn_cast<BlockAddress>(C)) {
Function *F = cast<Function>(MapValue(BA->getFunction(), VM));
- BasicBlock *BB = cast_or_null<BasicBlock>(MapValue(BA->getBasicBlock(),VM));
- return VM[V] = BlockAddress::get(F, BB ? BB : BA->getBasicBlock());
+ BasicBlock *BB = 0;
+ if (BA->getBasicBlock()) {
+ BB = cast_or_null<BasicBlock>(MapValue(BA->getBasicBlock(),VM));
+ BB = BB ? BB : BA->getBasicBlock();
+ }
+
+ return VM[V] = BlockAddress::get(F, BB);
}
llvm_unreachable("Unknown type of constant!");
More information about the llvm-commits
mailing list