I've just noticed this, in Instruction::isSafeToSpeculativelyExecute(): http://llvm.org/doxygen/Instruction_8cpp-source.html#l00408 00430 case Load: { 00431 if (cast<LoadInst>(this)->isVolatile()) 00432 return false; 00433 if (isa<AllocaInst>(getOperand(0)) || isMalloc(getOperand(0))) 00434 return true; This says that it's safe to speculatively execute a load from the pointer returned by malloc(). But surely that's not true if malloc() returns NULL. Thanks, Jay.
Chris Lattner
2010-Jan-03 18:14 UTC
[LLVMdev] safe to speculatively execute load of malloc?
You're right, fixed in r92452. -Chris On Jan 3, 2010, at 4:54 AM, Jay Foad wrote:> I've just noticed this, in Instruction::isSafeToSpeculativelyExecute(): > > http://llvm.org/doxygen/Instruction_8cpp-source.html#l00408 > > 00430 case Load: { > 00431 if (cast<LoadInst>(this)->isVolatile()) > 00432 return false; > 00433 if (isa<AllocaInst>(getOperand(0)) || isMalloc(getOperand(0))) > 00434 return true; > > This says that it's safe to speculatively execute a load from the > pointer returned by malloc(). But surely that's not true if malloc() > returns NULL. > > Thanks, > Jay. > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Seemingly Similar Threads
- Message: "err:psdrv:PSDRV_PPDGetNextTuple Line too long."
- [LLVMdev] Verifier should not make any assumptions about calls to "malloc"
- [LLVMdev] Verifier should not make any assumptions about calls to "malloc"
- [LLVMdev] Verifier should not make any assumptions about calls to "malloc"
- [LLVMdev] The best way to cope with AllocationInst type in old code?