[PATCH] LLVM intrinsic for invariants
Philip Reames
listmail at philipreames.com
Wed Jul 16 16:50:02 PDT 2014
Two quick items:
- Why should llvm.invariant(undef) be equivalent to the true case not
the false case? We should be able to pick either and it seems like
replacing with unreachable is strictly more powerful.
- Adding a canonicalization of if(c) { unreachable } to
llvm.invariant(c) would be worthwhile. It would strengthen the
optimizer against existing patterns.
Detailed code comments to follow once we've worked out the high level
semantics on llvm-dev.
On 07/12/2014 10:12 AM, hfinkel at anl.gov wrote:
> This adds the basic invariant intrinsic, noop lowering, and some basic properties:
>
> - llvm.invariant(undef) and llvm.invariant(true) are dead
> - llvm.invariant(false) is unreachable (this directly corresponds to the documented behavior of MSVC's __assume(0))
>
> The intrinsic is tagged as writing arbitrarily, in order to maintain control dependencies. BasicAA has been updated, however, to return NoModRef for any particular location-based query so that we don't unnecessarily block code motion.
>
> http://reviews.llvm.org/D178
>
> Files:
> docs/LangRef.rst
> include/llvm/IR/Intrinsics.td
> lib/Analysis/BasicAliasAnalysis.cpp
> lib/Analysis/TargetTransformInfo.cpp
> lib/CodeGen/BasicTargetTransformInfo.cpp
> lib/CodeGen/IntrinsicLowering.cpp
> lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
> lib/Transforms/Utils/Local.cpp
> test/Analysis/BasicAA/invariant.ll
> test/CodeGen/Generic/invariant.ll
> test/Transforms/InstSimplify/invariant.ll
> test/Transforms/SimplifyCFG/invariant.ll
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140716/8bd17715/attachment.html>
More information about the llvm-commits
mailing list