[llvm] 4e37f06 - [NFC] Remove isSafeToSpeculativelyExecute checks for casts

Sergey Kachkov via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 3 02:39:24 PST 2023


Author: Sergey Kachkov
Date: 2023-02-03T13:38:58+03:00
New Revision: 4e37f068dcf4fb21c5e34581b90ebbf659025020

URL: https://github.com/llvm/llvm-project/commit/4e37f068dcf4fb21c5e34581b90ebbf659025020
DIFF: https://github.com/llvm/llvm-project/commit/4e37f068dcf4fb21c5e34581b90ebbf659025020.diff

LOG: [NFC] Remove isSafeToSpeculativelyExecute checks for casts

isSafeToSpeculativelyExecute always return true for casts, so remove
this redundant checks.

Differential Revision: https://reviews.llvm.org/D143255

Added: 
    

Modified: 
    llvm/lib/Analysis/PHITransAddr.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/PHITransAddr.cpp b/llvm/lib/Analysis/PHITransAddr.cpp
index 70a5aa6ba298..6b5d10955a56 100644
--- a/llvm/lib/Analysis/PHITransAddr.cpp
+++ b/llvm/lib/Analysis/PHITransAddr.cpp
@@ -26,12 +26,7 @@ static cl::opt<bool> EnableAddPhiTranslation(
     cl::desc("Enable phi-translation of add instructions"));
 
 static bool canPHITrans(Instruction *Inst) {
-  if (isa<PHINode>(Inst) ||
-      isa<GetElementPtrInst>(Inst))
-    return true;
-
-  if (isa<CastInst>(Inst) &&
-      isSafeToSpeculativelyExecute(Inst))
+  if (isa<PHINode>(Inst) || isa<GetElementPtrInst>(Inst) || isa<CastInst>(Inst))
     return true;
 
   if (Inst->getOpcode() == Instruction::Add &&
@@ -182,7 +177,6 @@ Value *PHITransAddr::translateSubExpr(Value *V, BasicBlock *CurBB,
   // operands need to be phi translated, and if so, reconstruct it.
 
   if (CastInst *Cast = dyn_cast<CastInst>(Inst)) {
-    if (!isSafeToSpeculativelyExecute(Cast)) return nullptr;
     Value *PHIIn = translateSubExpr(Cast->getOperand(0), CurBB, PredBB, DT);
     if (!PHIIn) return nullptr;
     if (PHIIn == Cast->getOperand(0))
@@ -373,7 +367,6 @@ Value *PHITransAddr::insertTranslatedSubExpr(
 
   // Handle cast of PHI translatable value.
   if (CastInst *Cast = dyn_cast<CastInst>(Inst)) {
-    if (!isSafeToSpeculativelyExecute(Cast)) return nullptr;
     Value *OpVal = insertTranslatedSubExpr(Cast->getOperand(0), CurBB, PredBB,
                                            DT, NewInsts);
     if (!OpVal) return nullptr;


        


More information about the llvm-commits mailing list