[LLVMdev] LICM for function calls (original) (raw)
Hal Finkel hfinkel at anl.gov
Wed Jul 15 22:38:17 PDT 2015
- Previous message: [LLVMdev] LICM for function calls
- Next message: [LLVMdev] LICM for function calls
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
----- Original Message -----
From: "Thomas F Raoux" <thomas.f.raoux at intel.com> To: llvmdev at cs.uiuc.edu Sent: Tuesday, July 14, 2015 9:45:20 AM Subject: [LLVMdev] LICM for function calls
Hi, Right now in LICM (and many other transformations) we always assume it is never safe to speculatively execute a function call. The following function always return false for all function calls except for few intrinsics: bool llvm::isSafeToSpeculativelyExecute(const Value *V, const DataLayout *TD) { ... case Instruction::Call: { if (const IntrinsicInst *II = dyncast(Inst)) { ... } return false; // The called function could have undefined behavior or // side-effects, even if marked readnone nounwind. In some cases this could have an important performance impact so I'm looking for a potential way to improve it. Is there any combination of attributes which would guarantee that a function is safe to speculatively execute a function call? (As far as I can tell there isn't.) Does anybody have a suggestion on what would be the best way to implement such functionality? Or do you think such optimization is undesirable?
I think we'd need some kind of 'safe_to_speculate' attribute on the function. Regarding the optimization, under what circumstances would you want to speculate a function? I can imagine doing this only if I knew the function would be lowered in the backend to some simple set of instructions.
-Hal
Cheers, Thomas
LLVM Developers mailing list LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
-- Hal Finkel Assistant Computational Scientist Leadership Computing Facility Argonne National Laboratory
- Previous message: [LLVMdev] LICM for function calls
- Next message: [LLVMdev] LICM for function calls
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]