[IR] Add token types
[oota-llvm.git] / lib / Transforms / Scalar / JumpThreading.cpp
index 6ad782f5089b4d31b10795285506ca65a7477aa5..b87f4766e8dc94ea0bd980e0543d7d4fab0afe25 100644 (file)
@@ -260,6 +260,11 @@ static unsigned getJumpThreadDuplicationCost(const BasicBlock *BB,
     if (isa<BitCastInst>(I) && I->getType()->isPointerTy())
       continue;
 
+    // Bail out if this instruction gives back a token type, it is not possible
+    // to duplicate it if it used outside this BB.
+    if (I->getType()->isTokenTy() && I->isUsedOutsideOfBlock(BB))
+      return ~0U;
+
     // All other instructions count for at least one unit.
     ++Size;