From: Nikita Popov Date: Thu, 20 Jul 2023 12:17:07 +0000 (+0200) Subject: [InstCombine] Avoid ConstantExpr::getAnd() (NFCI) X-Git-Tag: upstream/17.0.6~992 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cdab6116eba92ce27d780d43e14a7ca15b972e7b;p=platform%2Fupstream%2Fllvm.git [InstCombine] Avoid ConstantExpr::getAnd() (NFCI) In preparation for removing and constant expressions. --- diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index d956d99f..dbb33e8 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -199,7 +199,11 @@ Instruction *InstCombinerImpl::foldCmpLoadFromIndexedGlobal( } // If the element is masked, handle it. - if (AndCst) Elt = ConstantExpr::getAnd(Elt, AndCst); + if (AndCst) { + Elt = ConstantFoldBinaryOpOperands(Instruction::And, Elt, AndCst, DL); + if (!Elt) + return nullptr; + } // Find out if the comparison would be true or false for the i'th element. Constant *C = ConstantFoldCompareInstOperands(ICI.getPredicate(), Elt,