InstCombine/AMDGPU: Fix constant folding of llvm.amdgcn.{icmp,fcmp}
authorNicolai Haehnle <nhaehnle@gmail.com>
Mon, 24 Apr 2017 17:08:43 +0000 (17:08 +0000)
committerNicolai Haehnle <nhaehnle@gmail.com>
Mon, 24 Apr 2017 17:08:43 +0000 (17:08 +0000)
commit9c661853150e304b9c6604df44a0181795ae633f
treee6e026dc794a12760af5d1a083b254930e5cea00
parent87aafa073fcc56a266a97a4de9b86e1e1b2f165a
InstCombine/AMDGPU: Fix constant folding of llvm.amdgcn.{icmp,fcmp}

Summary:
The return value of these intrinsics should always have 0 bits for
inactive threads. This means that when all arguments are constant
and the comparison evaluates to true, the intrinsic should return
the current exec mask.

Fixes some GL_ARB_shader_ballot tests.

Reviewers: arsenm

Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, llvm-commits, t-tye

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

llvm-svn: 301195
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/test/Transforms/InstCombine/amdgcn-intrinsics.ll