[PATCH] D49144: [FunctionAttrs] Infer the speculatable attribute

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 12 19:35:31 PDT 2018


hfinkel updated this revision to Diff 155312.
hfinkel added a comment.

Updated to not infer speculatable if there are instructions with non-debug metadata, loads with alignment requirements that we can't independently prove, and for functions with value-constraining return-value attributes.

There other change that's here, although I'll split it out into a separate patch with tests if we agree it's the right approach, is an update to isSafeToSpeculativelyExecute: For calls with the speculatable attibute that have function-argument attributes that are value constraining (align in general, nonnull, dereferenceable), we need to independently prove the necessary conditions in order for isSafeToSpeculativelyExecute to return true. I think that this is the right thing to do because the violation of those constraints is currently defined to be UB (not poison). If we don't do this, then we can't infer speculatable on function with arguments with these attributes either.


https://reviews.llvm.org/D49144

Files:
  lib/Analysis/ValueTracking.cpp
  lib/Transforms/IPO/FunctionAttrs.cpp
  test/CodeGen/AMDGPU/inline-attr.ll
  test/Transforms/FunctionAttrs/atomic.ll
  test/Transforms/FunctionAttrs/optnone.ll
  test/Transforms/Reassociate/reassociate-deadinst.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49144.155312.patch
Type: text/x-patch
Size: 11463 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180713/6b39add7/attachment.bin>


More information about the llvm-commits mailing list