mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-11 21:38:19 +00:00
It turns out that with the current scev organization ReuseOrCreateCast cannot
know where users will be added. Because of this, it cannot use Builder.GetInsertPoint at all. This patch * removes the FIXME about adding the assert. * adds a comment explaining hy we don't have one. * removes a broken logic that only works for some callers and is not needed since r150884. * adds an assert to caller that would have caught the bug fixed by r150884. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151015 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -31,13 +31,11 @@ using namespace llvm;
|
|||||||
Value *SCEVExpander::ReuseOrCreateCast(Value *V, Type *Ty,
|
Value *SCEVExpander::ReuseOrCreateCast(Value *V, Type *Ty,
|
||||||
Instruction::CastOps Op,
|
Instruction::CastOps Op,
|
||||||
BasicBlock::iterator IP) {
|
BasicBlock::iterator IP) {
|
||||||
// All new or reused instructions must strictly dominate the Builder's
|
// All new or reused instructions must strictly dominate their uses.
|
||||||
// InsertPt to ensure that the expression's expansion dominates its uses.
|
// It would be nice to assert this here, but we don't always know where
|
||||||
// Assert that the requested insertion point works at least for new
|
// the next instructions will be added as the the caller can move the
|
||||||
// instructions.
|
// Builder's InsertPt before creating them and we might be called with
|
||||||
|
// an invalid InsertPt.
|
||||||
// FIXME: disabled to make the bots happy.
|
|
||||||
//assert(SE.DT->dominates(IP, Builder.GetInsertPoint()));
|
|
||||||
|
|
||||||
// Check to see if there is already a cast!
|
// Check to see if there is already a cast!
|
||||||
for (Value::use_iterator UI = V->use_begin(), E = V->use_end();
|
for (Value::use_iterator UI = V->use_begin(), E = V->use_end();
|
||||||
@ -47,8 +45,7 @@ Value *SCEVExpander::ReuseOrCreateCast(Value *V, Type *Ty,
|
|||||||
if (CastInst *CI = dyn_cast<CastInst>(U))
|
if (CastInst *CI = dyn_cast<CastInst>(U))
|
||||||
if (CI->getOpcode() == Op) {
|
if (CI->getOpcode() == Op) {
|
||||||
// If the cast isn't where we want it, fix it.
|
// If the cast isn't where we want it, fix it.
|
||||||
if (BasicBlock::iterator(CI) != IP
|
if (BasicBlock::iterator(CI) != IP) {
|
||||||
|| IP == Builder.GetInsertPoint()) {
|
|
||||||
// Create a new cast, and leave the old cast in place in case
|
// Create a new cast, and leave the old cast in place in case
|
||||||
// it is being used as an insert point. Clear its operand
|
// it is being used as an insert point. Clear its operand
|
||||||
// so that it doesn't hold anything live.
|
// so that it doesn't hold anything live.
|
||||||
@ -506,6 +503,9 @@ Value *SCEVExpander::expandAddToGEP(const SCEV *const *op_begin,
|
|||||||
V = InsertNoopCastOfTo(V,
|
V = InsertNoopCastOfTo(V,
|
||||||
Type::getInt8PtrTy(Ty->getContext(), PTy->getAddressSpace()));
|
Type::getInt8PtrTy(Ty->getContext(), PTy->getAddressSpace()));
|
||||||
|
|
||||||
|
Instruction *Inst = dyn_cast<Instruction>(V);
|
||||||
|
assert(!Inst || SE.DT->properlyDominates(Inst, Builder.GetInsertPoint()));
|
||||||
|
|
||||||
// Expand the operands for a plain byte offset.
|
// Expand the operands for a plain byte offset.
|
||||||
Value *Idx = expandCodeFor(SE.getAddExpr(Ops), Ty);
|
Value *Idx = expandCodeFor(SE.getAddExpr(Ops), Ty);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user