[PATCH] D32482: [EarlyCSE] Mark the condition of assume intrinsic as true

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 27 00:10:42 PDT 2017


mkazantsev added inline comments.


================
Comment at: lib/Transforms/Scalar/EarlyCSE.cpp:638
     // they're marked as such to ensure preservation of control dependencies),
-    // and this pass will not disturb any of the assumption's control
-    // dependencies.
+    // and this pass will not bother with its removal. However, we should mark
+    // its condition as true for all dominated blocks.
----------------
dberlin wrote:
> sanjoy wrote:
> > I think you can do:
> > 
> > ```
> > Instruction *CondI;
> > if (match(Inst, m_Intrinsic<Intrinsic::assume>(m_Instruction(CondI))) &&
> >     SimpleValue::canHandle(CondI))
> >   AvailableValues.insert(CondI, ConstantInt::getTrue(BB->getContext()));
> > ```
> > 
> Can you please also just add a test that llvm.assume(false/true) is skipped?
> 
@sanjoy , no, because we need to skip assume even if its arg is not an instruction. Added test18 on that.
@dberlin , added tests 16 and 17 on that.


https://reviews.llvm.org/D32482





More information about the llvm-commits mailing list