[llvm] [clang] [InstCombine] Infer disjoint flag on Or instructions. (PR #72912)

2023-12-04 Thread Nikita Popov via cfe-commits
nikic wrote: > We don't have a `isGuaranteedNotToBeUndef` only function, so that's the only > way. I would leave a fixme, since this call can be removed if we ever manage > to kill undef. I actually added this function earlier today. > @nikic is something like this the right fix? I'd move th

[llvm] [clang] [InstCombine] Infer disjoint flag on Or instructions. (PR #72912)

2023-12-04 Thread Nuno Lopes via cfe-commits
nunoplopes wrote: We don't have a `isGuaranteedNotToBeUndef` only function, so that's the only way. I would leave a fixme, since this call can be removed if we ever manage to kill undef. Thanks for your help! 🙂 https://github.com/llvm/llvm-project/pull/72912 ___

[llvm] [clang] [InstCombine] Infer disjoint flag on Or instructions. (PR #72912)

2023-12-04 Thread Nuno Lopes via cfe-commits
nunoplopes wrote: Here's a simple-ish example: ```llvm ; Transforms/InstCombine/add.ll define i5 @zext_sext_not(i4 %x) { %zx = zext i4 %x to i5 %notx = xor i4 %x, 15 %snotx = sext i4 %notx to i5 %r = add i5 %zx, %snotx ret i5 %r } => define i5 @zext_sext_not(i4 %x) { %zx = zext i4 %x

[llvm] [clang] [InstCombine] Infer disjoint flag on Or instructions. (PR #72912)

2023-12-04 Thread Craig Topper via cfe-commits
topperc wrote: > FWIW, Alive2 is complaining about this commit. These patches are not safe > w.r.t. undef. Why not? https://github.com/llvm/llvm-project/pull/72912 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin

[llvm] [clang] [InstCombine] Infer disjoint flag on Or instructions. (PR #72912)

2023-11-27 Thread Craig Topper via cfe-commits
topperc wrote: Are the KnownBits in SimplifyDemandedBit usable? We have this code ``` if (SimplifyDemandedBits(I, 1, DemandedMask, RHSKnown, Depth + 1) || SimplifyDemandedBits(I, 0, DemandedMask & ~RHSKnown.One, LHSKnown, Depth + 1)) {

[llvm] [clang] [InstCombine] Infer disjoint flag on Or instructions. (PR #72912)

2023-11-27 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Craig Topper (topperc) Changes Stacked on https://github.com/llvm/llvm-project/pull/72702 and https://github.com/llvm/llvm-project/pull/72583 --- Patch is 153.23 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/l

[llvm] [clang] [InstCombine] Infer disjoint flag on Or instructions. (PR #72912)

2023-11-27 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-llvm-transforms Author: Craig Topper (topperc) Changes Stacked on https://github.com/llvm/llvm-project/pull/72702 and https://github.com/llvm/llvm-project/pull/72583 --- Patch is 153.23 KiB, truncated to 20.00 KiB below, full version: https://github.

[llvm] [clang] [InstCombine] Infer disjoint flag on Or instructions. (PR #72912)

2023-11-27 Thread Craig Topper via cfe-commits
topperc wrote: > Also you'll want to do this inside SimplifyDemanded to reuse existing > KnownBits information. Do we do that for other flags already? I based this off Add/Sub. https://github.com/llvm/llvm-project/pull/72912 ___ cfe-commits mailing l

[llvm] [clang] [InstCombine] Infer disjoint flag on Or instructions. (PR #72912)

2023-11-27 Thread Nikita Popov via cfe-commits
nikic wrote: Needs a rebase. Also you'll want to do this inside SimplifyDemanded to reuse existing KnownBits information. https://github.com/llvm/llvm-project/pull/72912 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cg