[PATCH] D38336: Add an @llvm.sideeffect intrinsic

Dan Gohman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 27 15:09:47 PDT 2017


sunfish created this revision.
Herald added a subscriber: aheejin.

This patch implements Chandler's idea <http://lists.llvm.org/pipermail/llvm-dev/2015-July/088103.html> for supporting languages that require support for infinite loops with side effects, such as Rust, providing a solution to bug 965 <https://bugs.llvm.org/show_bug.cgi?id=965>.

Specifically, it adds an `llvm.sideeffect()` intrinsic, which has no actual effect, but which appears to optimization passes to have obscure side effects, such that they don't optimize away loops containing it. It also teaches several optimization passes to ignore this intrinsic, so that it doesn't significantly impact optimization in most cases.


Repository:
  rL LLVM

https://reviews.llvm.org/D38336

Files:
  docs/LangRef.rst
  include/llvm/Analysis/TargetTransformInfoImpl.h
  include/llvm/CodeGen/BasicTTIImpl.h
  include/llvm/IR/Intrinsics.td
  lib/Analysis/AliasSetTracker.cpp
  lib/Analysis/ValueTracking.cpp
  lib/Analysis/VectorUtils.cpp
  lib/CodeGen/SelectionDAG/FastISel.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  lib/Transforms/Scalar/EarlyCSE.cpp
  lib/Transforms/Scalar/GVNHoist.cpp
  lib/Transforms/Utils/Evaluator.cpp
  lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
  lib/Transforms/Vectorize/LoopVectorize.cpp
  lib/Transforms/Vectorize/SLPVectorizer.cpp
  test/CodeGen/Generic/intrinsics.ll
  test/Transforms/DCE/int_sideeffect.ll
  test/Transforms/DeadStoreElimination/int_sideeffect.ll
  test/Transforms/EarlyCSE/int_sideeffect.ll
  test/Transforms/FunctionAttrs/int_sideeffect.ll
  test/Transforms/GVN/int_sideeffect.ll
  test/Transforms/GVNHoist/int_sideeffect.ll
  test/Transforms/GVNSink/int_sideeffect.ll
  test/Transforms/GlobalOpt/int_sideeffect.ll
  test/Transforms/InstCombine/int_sideeffect.ll
  test/Transforms/LICM/int_sideeffect.ll
  test/Transforms/LoadStoreVectorizer/int_sideeffect.ll
  test/Transforms/LoopIdiom/int_sideeffect.ll
  test/Transforms/LoopVectorize/int_sideeffect.ll
  test/Transforms/NewGVN/int_sideeffect.ll
  test/Transforms/SLPVectorizer/int_sideeffect.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38336.116888.patch
Type: text/x-patch
Size: 22142 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170927/207b4f78/attachment.bin>


More information about the llvm-commits mailing list