[PATCH] D49238: [InstCombine] add more SPFofSPF folding
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 12 17:05:29 PDT 2018
spatel added inline comments.
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:4640-4641
// Set LHS and RHS so that RHS is the negated operand of the select
+ bool CmpUsesNegatedOp = match(CmpLHS, m_Neg(m_Specific(TrueVal))) ||
+ match(CmpLHS, m_Neg(m_Specific(FalseVal)));
if (match(TrueVal, MaybeSExtLHS)) {
----------------
What happens if the cmp uses a negated and sign-extended op? I'm not sure if this is possible because of other transforms. Do we have test(s) that include that possibility?
================
Comment at: llvm/test/Transforms/InstCombine/abs_abs.ll:333-336
; CHECK-LABEL: @abs_abs_x02_vec(
; CHECK-NEXT: [[SUB:%.*]] = sub nsw <2 x i32> zeroinitializer, [[X:%.*]]
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt <2 x i32> [[SUB]], <i32 -1, i32 -1>
; CHECK-NEXT: [[COND:%.*]] = select <2 x i1> [[CMP]], <2 x i32> [[SUB]], <2 x i32> [[X]]
----------------
Do you know why the scalar version above folded, but the vector version did not? Something is falsely excluding vector types.
https://reviews.llvm.org/D49238
More information about the llvm-commits
mailing list