[llvm] [InstCombine] Fold comparison of adding two z/sext booleans (PR #67895)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 2 02:50:10 PDT 2023
================
@@ -2895,19 +2896,86 @@ Instruction *InstCombinerImpl::foldICmpSubConstant(ICmpInst &Cmp,
return new ICmpInst(SwappedPred, Add, ConstantInt::get(Ty, ~C));
}
+static Value *createLogicFromTable(const std::bitset<4> &Table, Value *Op0,
+ Value *Op1, IRBuilderBase &Builder) {
+ switch (Table.to_ulong()) {
+ case 0: // 0 0 0 0
+ return Builder.getFalse();
+ case 1: // 0 0 0 1
+ return Builder.CreateNot(Builder.CreateOr(Op0, Op1));
+ case 2: // 0 0 1 0
+ return Builder.CreateAnd(Builder.CreateNot(Op0), Op1);
+ case 3: // 0 0 1 1
+ return Op1;
----------------
dtcxzyw wrote:
```suggestion
return Builder.CreateNot(Op0);
```
https://github.com/llvm/llvm-project/pull/67895
More information about the llvm-commits
mailing list