[all-commits] [llvm/llvm-project] f6e22f: [llvm][Uniformity] A phi with an undef argument is...

Sameer Sahasrabuddhe via All-commits all-commits at lists.llvm.org
Mon Feb 20 00:57:27 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f6e22f2f63b4f44adb904d017313f5a286a3a89f
      https://github.com/llvm/llvm-project/commit/f6e22f2f63b4f44adb904d017313f5a286a3a89f
  Author: Sameer Sahasrabuddhe <sameer.sahasrabuddhe at amd.com>
  Date:   2023-02-20 (Mon, 20 Feb 2023)

  Changed paths:
    M llvm/include/llvm/ADT/GenericUniformityImpl.h
    M llvm/include/llvm/CodeGen/MachineSSAContext.h
    M llvm/include/llvm/IR/SSAContext.h
    M llvm/lib/CodeGen/MachineSSAContext.cpp
    M llvm/lib/IR/SSAContext.cpp
    M llvm/test/Analysis/DivergenceAnalysis/AMDGPU/phi-undef.ll

  Log Message:
  -----------
  [llvm][Uniformity] A phi with an undef argument is not always divergent

The uniformity analysis treated an undef argument to phi to be distinct from any
other argument, equivalent to calling PHINode::hasConstantValue() instead of
PHINode::hasConstantOrUndefValue(). Such a phi was reported as divergent. This
is different from the older divergence analysis which treats such a phi as
uniform. Fixed uniformity analysis to match the older behaviour.

The original behaviour was added to DivergenceAnalysis in D19013. But it is not
clear if relying on the undef value is safe. The defined values are not constant
per se; they just happen to be uniform and the non-constant uniform value may
not dominate the PHI.

Reviewed By: ruiling

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




More information about the All-commits mailing list