[llvm-commits] [llvm] r147560 - in /llvm/trunk: include/llvm/Analysis/ValueTracking.h lib/Analysis/ValueTracking.cpp
Duncan Sands
baldrick at free.fr
Thu Jan 5 00:25:15 PST 2012
Hi Dan,
> Generalize isSafeToSpeculativelyExecute to work on arbitrary
> Values, rather than just Instructions, since it's interesting
> for ConstantExprs too.
since constants are not executed, what does this mean? I notice that all
constants results in 'false', i.e. not safe to speculatively execute. Why
is that?
Ciao, Duncan.
>
> Modified:
> llvm/trunk/include/llvm/Analysis/ValueTracking.h
> llvm/trunk/lib/Analysis/ValueTracking.cpp
>
> Modified: llvm/trunk/include/llvm/Analysis/ValueTracking.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ValueTracking.h?rev=147560&r1=147559&r2=147560&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Analysis/ValueTracking.h (original)
> +++ llvm/trunk/include/llvm/Analysis/ValueTracking.h Wed Jan 4 17:01:09 2012
> @@ -174,7 +174,7 @@
> /// the correct dominance relationships for the operands and users hold.
> /// However, this method can return true for instructions that read memory;
> /// for such instructions, moving them may change the resulting value.
> - bool isSafeToSpeculativelyExecute(const Instruction *Inst,
> + bool isSafeToSpeculativelyExecute(const Value *V,
> const TargetData *TD = 0);
>
> } // end namespace llvm
>
> Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=147560&r1=147559&r2=147560&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
> +++ llvm/trunk/lib/Analysis/ValueTracking.cpp Wed Jan 4 17:01:09 2012
> @@ -1879,8 +1879,12 @@
> return true;
> }
>
> -bool llvm::isSafeToSpeculativelyExecute(const Instruction *Inst,
> +bool llvm::isSafeToSpeculativelyExecute(const Value *V,
> const TargetData *TD) {
> + const Operator *Inst = dyn_cast<Operator>(V);
> + if (!Inst)
> + return false;
> +
> for (unsigned i = 0, e = Inst->getNumOperands(); i != e; ++i)
> if (Constant *C = dyn_cast<Constant>(Inst->getOperand(i)))
> if (C->canTrap())
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list