[PATCH] D15859: [InstructionCombining] prepareICWorklistFromFunction halts in infinite loop with instructions of token type

Chen Li via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 4 14:31:57 PST 2016


chenli added inline comments.

================
Comment at: lib/Transforms/InstCombine/InstructionCombining.cpp:3022-3032
@@ -3021,14 +3021,13 @@
       Instruction *Inst = &*--EndInst->getIterator();
       if (!Inst->use_empty() && !Inst->getType()->isTokenTy())
         Inst->replaceAllUsesWith(UndefValue::get(Inst->getType()));
-      if (Inst->isEHPad()) {
+      if (Inst->isEHPad() || Inst->getType()->isTokenTy()) {
         EndInst = Inst;
         continue;
       }
       if (!isa<DbgInfoIntrinsic>(Inst)) {
         ++NumDeadInst;
         MadeIRChange = true;
       }
-      if (!Inst->getType()->isTokenTy())
-        Inst->eraseFromParent();
+      Inst->eraseFromParent();
     }
----------------
majnemer wrote:
> Would anything go wrong if we simply had:
>       if (!Inst->use_empty())
>         Inst->replaceAllUsesWith(UndefValue::get(Inst->getType()));
>       if (Inst->isEHPad()) {
>         EndInst = Inst;
>         continue;
>       }
>       if (!isa<DbgInfoIntrinsic>(Inst)) {
>         ++NumDeadInst;
>         MadeIRChange = true;
>       }
> 
>       Inst->eraseFromParent();
It will actually hit a verifier assertion failure if gc.relocate instruction takes an undef gc.statepoint token. But the verifier could be fixed in a later patch if we'd like to have the code you suggested. I dont know if there's similar issues for uses of cleanuppad or catchpad. 


http://reviews.llvm.org/D15859





More information about the llvm-commits mailing list