@@ -749,18 +749,18 @@ Instruction *InstCombinerImpl::visitTrunc(TruncInst &Trunc) {
749
749
}
750
750
751
751
Constant *C;
752
- if (match (Src, m_OneUse (m_LShr (m_Value (X), m_Constant (C))))) {
752
+ if (match (Src, m_OneUse (m_LShr (m_Value (X), m_ImmConstant (C))))) {
753
753
// trunc (lshr X, C) to i1 --> icmp ne (and X, C'), 0
754
754
Constant *One = ConstantInt::get (SrcTy, APInt (SrcWidth, 1 ));
755
- Constant *MaskC = ConstantExpr::getShl (One, C);
755
+ Value *MaskC = Builder. CreateShl (One, C);
756
756
Value *And = Builder.CreateAnd (X, MaskC);
757
757
return new ICmpInst (ICmpInst::ICMP_NE, And, Zero);
758
758
}
759
759
if (match (Src, m_OneUse (m_c_Or (m_LShr (m_Value (X), m_ImmConstant (C)),
760
760
m_Deferred (X))))) {
761
761
// trunc (or (lshr X, C), X) to i1 --> icmp ne (and X, C'), 0
762
762
Constant *One = ConstantInt::get (SrcTy, APInt (SrcWidth, 1 ));
763
- Constant *MaskC = ConstantExpr::getShl (One, C);
763
+ Value *MaskC = Builder. CreateShl (One, C);
764
764
Value *And = Builder.CreateAnd (X, Builder.CreateOr (MaskC, One));
765
765
return new ICmpInst (ICmpInst::ICMP_NE, And, Zero);
766
766
}
0 commit comments