[all-commits] [llvm/llvm-project] e44b11: [ValueTracking] Treat branch on undef as UB as well

Nikita Popov via All-commits all-commits at lists.llvm.org
Mon Jan 2 03:34:38 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e44b11d9b6baa0bfc3d864d455a4b5717499f05b
      https://github.com/llvm/llvm-project/commit/e44b11d9b6baa0bfc3d864d455a4b5717499f05b
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-01-02 (Mon, 02 Jan 2023)

  Changed paths:
    M llvm/lib/Analysis/ValueTracking.cpp
    M llvm/test/Transforms/Attributor/ArgumentPromotion/control-flow.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/return-argument.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/return-constant.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/return-constants.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/solve-after-each-resolving-undefs-for-function.ll
    M llvm/test/Transforms/Attributor/align.ll
    M llvm/test/Transforms/Attributor/dereferenceable-1.ll
    M llvm/test/Transforms/Attributor/dereferenceable-2-inseltpoison.ll
    M llvm/test/Transforms/Attributor/dereferenceable-2.ll
    M llvm/test/Transforms/Attributor/memory_locations.ll
    M llvm/test/Transforms/Attributor/multiple-offsets-pointer-info.ll
    M llvm/test/Transforms/Attributor/nocapture-1.ll
    M llvm/test/Transforms/Attributor/nonnull.ll
    M llvm/test/Transforms/Attributor/norecurse.ll
    M llvm/test/Transforms/Attributor/nounwind.ll
    M llvm/test/Transforms/Attributor/potential.ll
    M llvm/test/Transforms/Attributor/range.ll
    M llvm/test/Transforms/Attributor/reduced/crash_ptr2int_cgscc.ll
    M llvm/test/Transforms/Attributor/returned.ll
    M llvm/test/Transforms/Attributor/undefined_behavior.ll
    M llvm/test/Transforms/Attributor/value-simplify-assume.ll
    M llvm/test/Transforms/Attributor/value-simplify-instances.ll
    M llvm/test/Transforms/Attributor/value-simplify-pointer-info.ll
    M llvm/test/Transforms/Attributor/value-simplify-reachability.ll
    M llvm/test/Transforms/Attributor/value-simplify.ll
    M llvm/test/Transforms/Attributor/willreturn.ll
    M llvm/test/Transforms/InstCombine/dont-distribute-phi.ll

  Log Message:
  -----------
  [ValueTracking] Treat branch on undef as UB as well

We were already treating branch on poison as UB, but branch on
undef is also UB. Move the checks into the correct function.

>From LangRef for br:

> If ‘cond’ is poison or undef, this instruction has undefined behavior.

>From LangRef for switch:

> If ‘value’ is poison or undef, this instruction has undefined behavior.

There is a minor regression in dont-distribute-phi.ll, apparently
we handle that pattern in logical but not bitwise form.




More information about the All-commits mailing list