diff options
| author | Rhys Perry <pendingchaos02@gmail.com> | 2019-01-07 15:52:28 +0000 | 
|---|---|---|
| committer | Rhys Perry <pendingchaos02@gmail.com> | 2019-01-07 15:52:28 +0000 | 
| commit | f77e2e84066779e7124208370006fecd997807f3 (patch) | |
| tree | b3f8d0420d4fae0db0c21410cb7ca48d39165b8a /llvm/lib/Target | |
| parent | f2001aa74394885dc178c5997b83687acb4f55e4 (diff) | |
| download | bcm5719-llvm-f77e2e84066779e7124208370006fecd997807f3.tar.gz bcm5719-llvm-f77e2e84066779e7124208370006fecd997807f3.zip | |
AMDGPU: test for uniformity of branch instruction, not its condition
Summary:
If a divergent branch instruction is marked as divergent by propagation
rule 2 in DivergencePropagator::exploreSyncDependency() and its condition
is uniform, that branch would incorrectly be assumed to be uniform.
Reviewers: arsenm, tstellar
Reviewed By: arsenm
Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D56331
llvm-svn: 350532
Diffstat (limited to 'llvm/lib/Target')
| -rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPUAnnotateUniformValues.cpp | 10 | ||||
| -rw-r--r-- | llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp | 2 | 
2 files changed, 3 insertions, 9 deletions
| diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAnnotateUniformValues.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAnnotateUniformValues.cpp index 4e0cc736bad..f88e3b0dac8 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUAnnotateUniformValues.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUAnnotateUniformValues.cpp @@ -117,14 +117,8 @@ bool AMDGPUAnnotateUniformValues::isClobberedInFunction(LoadInst * Load) {  }  void AMDGPUAnnotateUniformValues::visitBranchInst(BranchInst &I) { -  if (I.isUnconditional()) -    return; - -  Value *Cond = I.getCondition(); -  if (!DA->isUniform(Cond)) -    return; - -  setUniformMetadata(I.getParent()->getTerminator()); +  if (DA->isUniform(&I)) +    setUniformMetadata(I.getParent()->getTerminator());  }  void AMDGPUAnnotateUniformValues::visitLoadInst(LoadInst &I) { diff --git a/llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp b/llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp index 90f430d5ca4..98e9ea66232 100644 --- a/llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp +++ b/llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp @@ -155,7 +155,7 @@ bool SIAnnotateControlFlow::doInitialization(Module &M) {  /// Is the branch condition uniform or did the StructurizeCFG pass  /// consider it as such?  bool SIAnnotateControlFlow::isUniform(BranchInst *T) { -  return DA->isUniform(T->getCondition()) || +  return DA->isUniform(T) ||           T->getMetadata("structurizecfg.uniform") != nullptr;  } | 

