summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorAlexander Timofeev <Alexander.Timofeev@amd.com>2017-10-03 18:55:36 +0000
committerAlexander Timofeev <Alexander.Timofeev@amd.com>2017-10-03 18:55:36 +0000
commit46513965842fc117f3afb0c8ee2fb0fd329d78ae (patch)
treebe3f041b4a092a1a5ee8b5fb7c3dc3600fac7b96 /llvm/lib/Target
parent6b1be121c04b52ae105beee5065fc4b582f13388 (diff)
downloadbcm5719-llvm-46513965842fc117f3afb0c8ee2fb0fd329d78ae.tar.gz
bcm5719-llvm-46513965842fc117f3afb0c8ee2fb0fd329d78ae.zip
[AMDGPU] Avoid predicated execution of the basic blocks containing scalar
instructions. Differential revision: https://reviews.llvm.org/D38293 llvm-svn: 314828
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/AMDGPU/SIInsertSkips.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Target/AMDGPU/SIInsertSkips.cpp b/llvm/lib/Target/AMDGPU/SIInsertSkips.cpp
index ba346d2fad0..9bd58c45ce0 100644
--- a/llvm/lib/Target/AMDGPU/SIInsertSkips.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInsertSkips.cpp
@@ -132,6 +132,16 @@ bool SIInsertSkips::shouldSkip(const MachineBasicBlock &From,
I->getOpcode() == AMDGPU::S_CBRANCH_VCCZ)
return true;
+ // V_READFIRSTLANE/V_READLANE destination register may be used as operand
+ // by some SALU instruction. If exec mask is zero vector instruction
+ // defining the register that is used by the scalar one is not executed
+ // and scalar instruction will operate on undefined data. For
+ // V_READFIRSTLANE/V_READLANE we should avoid predicated execution.
+ if ((I->getOpcode() == AMDGPU::V_READFIRSTLANE_B32) ||
+ (I->getOpcode() == AMDGPU::V_READLANE_B32)) {
+ return true;
+ }
+
if (I->isInlineAsm()) {
const MCAsmInfo *MAI = MF->getTarget().getMCAsmInfo();
const char *AsmStr = I->getOperand(0).getSymbolName();
OpenPOWER on IntegriCloud