mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-26 09:18:56 +00:00
Add simplify_type<const WeakVH>; simplify IndVarSimplify
r240214 fixed some UB in IndVarSimplify, and it needed a temporary `WeakVH` to do it. Add `simplify_type<const WeakVH>` so that this temporary isn't necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240599 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -161,9 +161,11 @@ public:
|
|||||||
// dyn_cast, isa, etc.
|
// dyn_cast, isa, etc.
|
||||||
template <> struct simplify_type<WeakVH> {
|
template <> struct simplify_type<WeakVH> {
|
||||||
typedef Value *SimpleType;
|
typedef Value *SimpleType;
|
||||||
static SimpleType getSimplifiedValue(WeakVH &WVH) {
|
static SimpleType getSimplifiedValue(WeakVH &WVH) { return WVH; }
|
||||||
return WVH;
|
};
|
||||||
}
|
template <> struct simplify_type<const WeakVH> {
|
||||||
|
typedef Value *SimpleType;
|
||||||
|
static SimpleType getSimplifiedValue(const WeakVH &WVH) { return WVH; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief Value handle that asserts if the Value is deleted.
|
/// \brief Value handle that asserts if the Value is deleted.
|
||||||
|
@@ -2013,11 +2013,10 @@ bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
|
|||||||
|
|
||||||
// Now that we're done iterating through lists, clean up any instructions
|
// Now that we're done iterating through lists, clean up any instructions
|
||||||
// which are now dead.
|
// which are now dead.
|
||||||
while (!DeadInsts.empty()) {
|
while (!DeadInsts.empty())
|
||||||
Value *V = static_cast<Value *>(DeadInsts.pop_back_val());
|
if (Instruction *Inst =
|
||||||
if (Instruction *Inst = dyn_cast_or_null<Instruction>(V))
|
dyn_cast_or_null<Instruction>(DeadInsts.pop_back_val()))
|
||||||
RecursivelyDeleteTriviallyDeadInstructions(Inst, TLI);
|
RecursivelyDeleteTriviallyDeadInstructions(Inst, TLI);
|
||||||
}
|
|
||||||
|
|
||||||
// The Rewriter may not be used from this point on.
|
// The Rewriter may not be used from this point on.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user