[all-commits] [llvm/llvm-project] 84733b: [JT] check xor operand is exactly the same in proc...

Yingchi Long via All-commits all-commits at lists.llvm.org
Wed Dec 21 05:44:49 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 84733b0f179ecf3fc2c2fa051bf97c7c2ec8f0f9
      https://github.com/llvm/llvm-project/commit/84733b0f179ecf3fc2c2fa051bf97c7c2ec8f0f9
  Author: Yingchi Long <i at lyc.dev>
  Date:   2022-12-21 (Wed, 21 Dec 2022)

  Changed paths:
    M llvm/lib/Transforms/Scalar/JumpThreading.cpp
    A llvm/test/Transforms/JumpThreading/phi-xor-branch.ll

  Log Message:
  -----------
  [JT] check xor operand is exactly the same in processBranchOnXOR

Reproducer:

    ; RUN: opt -S -jump-threading < %s
    define void @test() {
    entry:
    br i1 false, label %loop, label %exit

    loop:
    %bool = phi i1 [ %xor, %loop.latch ], [ false, %entry ]
    %cmp = icmp eq i16 0, 1
    %xor = xor i1 %cmp, %bool
    br i1 %bool, label %loop.latch, label %exit

    loop.latch:
    %dummy = phi i16 [ 0, %loop ]
    br label %loop

    exit:
    ret void
    }

On this occassion, phi node %bool is actually %xor, and doing substitution causes assertion failure.

Fixes: https://github.com/llvm/llvm-project/issues/58812

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D139783




More information about the All-commits mailing list