diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2022-07-14 18:50:02 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2022-07-14 18:50:02 +0000 |
| commit | 1f917f69ff07f09b6dbb670971f57f8efe718b84 (patch) | |
| tree | 99293cbc1411737cd995dac10a99b2c40ef0944c /llvm/lib/Analysis/ValueTracking.cpp | |
| parent | 145449b1e420787bb99721a429341fa6be3adfb6 (diff) | |
Vendor import of llvm-project main llvmorg-15-init-16436-g18a6ab5b8d1f.vendor/llvm-project/llvmorg-15-init-16436-g18a6ab5b8d1f
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
| -rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 05d5e47bb8d7..add2d427e05b 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -4679,27 +4679,22 @@ bool llvm::mustSuppressSpeculation(const LoadInst &LI) { F.hasFnAttribute(Attribute::SanitizeHWAddress); } - -bool llvm::isSafeToSpeculativelyExecute(const Value *V, +bool llvm::isSafeToSpeculativelyExecute(const Instruction *Inst, const Instruction *CtxI, const DominatorTree *DT, const TargetLibraryInfo *TLI) { - const Operator *Inst = dyn_cast<Operator>(V); - if (!Inst) - return false; - return isSafeToSpeculativelyExecuteWithOpcode(Inst->getOpcode(), Inst, CtxI, DT, TLI); + return isSafeToSpeculativelyExecuteWithOpcode(Inst->getOpcode(), Inst, CtxI, + DT, TLI); } -bool llvm::isSafeToSpeculativelyExecuteWithOpcode(unsigned Opcode, - const Operator *Inst, - const Instruction *CtxI, - const DominatorTree *DT, - const TargetLibraryInfo *TLI) { +bool llvm::isSafeToSpeculativelyExecuteWithOpcode( + unsigned Opcode, const Instruction *Inst, const Instruction *CtxI, + const DominatorTree *DT, const TargetLibraryInfo *TLI) { #ifndef NDEBUG if (Inst->getOpcode() != Opcode) { // Check that the operands are actually compatible with the Opcode override. auto hasEqualReturnAndLeadingOperandTypes = - [](const Operator *Inst, unsigned NumLeadingOperands) { + [](const Instruction *Inst, unsigned NumLeadingOperands) { if (Inst->getNumOperands() < NumLeadingOperands) return false; const Type *ExpectedType = Inst->getType(); @@ -4715,11 +4710,6 @@ bool llvm::isSafeToSpeculativelyExecuteWithOpcode(unsigned Opcode, } #endif - for (unsigned i = 0, e = Inst->getNumOperands(); i != e; ++i) - if (Constant *C = dyn_cast<Constant>(Inst->getOperand(i))) - if (C->canTrap()) - return false; - switch (Opcode) { default: return true; |
