@@ -446,9 +446,9 @@ void llvm::computeKnownBitsFromRangeMetadata(const MDNode &Ranges,
446
446
}
447
447
448
448
static bool isEphemeralValueOf (const Instruction *I, const Value *E) {
449
- SmallVector<const Value *, 16 > WorkSet (1 , I);
450
- SmallPtrSet<const Value *, 32 > Visited;
451
- SmallPtrSet<const Value *, 16 > EphValues;
449
+ SmallVector<const Instruction *, 16 > WorkSet (1 , I);
450
+ SmallPtrSet<const Instruction *, 32 > Visited;
451
+ SmallPtrSet<const Instruction *, 16 > EphValues;
452
452
453
453
// The instruction defining an assumption's condition itself is always
454
454
// considered ephemeral to that assumption (even if it has other
@@ -457,28 +457,26 @@ static bool isEphemeralValueOf(const Instruction *I, const Value *E) {
457
457
return true ;
458
458
459
459
while (!WorkSet.empty ()) {
460
- const Value *V = WorkSet.pop_back_val ();
460
+ const Instruction *V = WorkSet.pop_back_val ();
461
461
if (!Visited.insert (V).second )
462
462
continue ;
463
463
464
464
// If all uses of this value are ephemeral, then so is this value.
465
- if (llvm:: all_of (V->users (), [&](const User *U) {
466
- return EphValues.count (U );
467
- })) {
465
+ if (all_of (V->users (), [&](const User *U) {
466
+ return EphValues.count (cast<Instruction>(U) );
467
+ })) {
468
468
if (V == E)
469
469
return true ;
470
470
471
- if (V == I || (isa<Instruction>(V) &&
472
- !cast<Instruction>(V)->mayHaveSideEffects () &&
473
- !cast<Instruction>(V)->isTerminator ())) {
474
- EphValues.insert (V);
475
-
476
- if (const User *U = dyn_cast<User>(V)) {
477
- for (const Use &U : U->operands ()) {
478
- if (!isa<Constant>(U))
479
- WorkSet.push_back (U.get ());
480
- }
481
- }
471
+ if (V == I || (!V->mayHaveSideEffects () && !V->isTerminator ())) {
472
+ EphValues.insert (V);
473
+
474
+ if (const User *U = dyn_cast<User>(V)) {
475
+ for (const Use &U : U->operands ()) {
476
+ if (const auto *I = dyn_cast<Instruction>(U.get ()))
477
+ WorkSet.push_back (I);
478
+ }
479
+ }
482
480
}
483
481
}
484
482
}
0 commit comments