[llvm] [VPlan] Add non-poison propagating LogicalAnd VPInstruction opcode. (PR #91897)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon May 13 12:45:56 PDT 2024
================
@@ -8011,14 +8011,10 @@ VPValue *VPRecipeBuilder::createEdgeMask(BasicBlock *Src, BasicBlock *Dst) {
EdgeMask = Builder.createNot(EdgeMask, BI->getDebugLoc());
if (SrcMask) { // Otherwise block in-mask is all-one, no need to AND.
- // The condition is 'SrcMask && EdgeMask', which is equivalent to
- // 'select i1 SrcMask, i1 EdgeMask, i1 false'.
- // The select version does not introduce new UB if SrcMask is false and
- // EdgeMask is poison. Using 'and' here introduces undefined behavior.
- VPValue *False = Plan.getOrAddLiveIn(
- ConstantInt::getFalse(BI->getCondition()->getType()));
- EdgeMask =
- Builder.createSelect(SrcMask, EdgeMask, False, BI->getDebugLoc());
+ // Use LogicalAnd as it does not propagate poison, i.e. does not introduce
+ // new UB if SrcMask is false and EdgeMask is poison. Using 'and' here
+ // introduces undefined behavior.
----------------
fhahn wrote:
Yes IIUC
https://github.com/llvm/llvm-project/pull/91897
More information about the llvm-commits
mailing list