[PATCH] D138700: [InstSimplify] Fold (X || Y) ? false && X --> false
    Sanjay Patel via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Nov 28 13:16:22 PST 2022
    
    
  
spatel added inline comments.
================
Comment at: llvm/test/Transforms/InstSimplify/select-logical.ll:201
 
 ; (X | Y) ? false && X --> false
 
----------------
Here and below - the usual notation for a select op if we are writing it like C code would be:
(X | Y) ? false : X --> false
================
Comment at: llvm/test/Transforms/InstSimplify/select-logical.ll:212
 
 ; (X | Y) ? false && X --> false
 
----------------
update comment to match test:
 (X | Y) ? false : Y --> false
================
Comment at: llvm/test/Transforms/InstSimplify/select-logical.ll:236
 
 define <2 x i1> @or_select_false_x_vector_poison(<2 x i1> %x, <2 x i1> %y) {
 ; CHECK-LABEL: @or_select_false_x_vector_poison(
----------------
We can transform this, but it must not propagate the poison:
https://alive2.llvm.org/ce/z/MsJicP
So it should be ok to leave the match with m_ZeroInt(), but instead of returning the existing TrueVal, return a "full" false constant:
  ConstantInt::getFalse(Cond->getType())
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138700/new/
https://reviews.llvm.org/D138700
    
    
More information about the llvm-commits
mailing list