[llvm] r309779 - [AMDGPU] Fix asan error after last commit

Stanislav Mekhanoshin via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 1 18:18:57 PDT 2017


Author: rampitec
Date: Tue Aug  1 18:18:57 2017
New Revision: 309779

URL: http://llvm.org/viewvc/llvm-project?rev=309779&view=rev
Log:
[AMDGPU] Fix asan error after last commit

Previous change "Turn s_and_saveexec_b64 into s_and_b64 if
result is unused" introduced asan use-after-poison error.
Instruction was analyzed after eraseFromParent() calls.

Move analysys higher than erase.

Modified:
    llvm/trunk/lib/Target/AMDGPU/SIOptimizeExecMaskingPreRA.cpp

Modified: llvm/trunk/lib/Target/AMDGPU/SIOptimizeExecMaskingPreRA.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIOptimizeExecMaskingPreRA.cpp?rev=309779&r1=309778&r2=309779&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIOptimizeExecMaskingPreRA.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/SIOptimizeExecMaskingPreRA.cpp Tue Aug  1 18:18:57 2017
@@ -138,6 +138,7 @@ bool SIOptimizeExecMaskingPreRA::runOnMa
 
     DEBUG(dbgs() << "Redundant EXEC = S_OR_B64 found: " << *Lead << '\n');
 
+    auto SaveExec = getOrExecSource(*Lead, *TII, MRI);
     unsigned SaveExecReg = getOrNonExecReg(*Lead, *TII);
     LIS->RemoveMachineInstrFromMaps(*Lead);
     Lead->eraseFromParent();
@@ -150,7 +151,6 @@ bool SIOptimizeExecMaskingPreRA::runOnMa
 
     // If the only use of saved exec in the removed instruction is S_AND_B64
     // fold the copy now.
-    auto SaveExec = getOrExecSource(*Lead, *TII, MRI);
     if (!SaveExec || !SaveExec->isFullCopy())
       continue;
 




More information about the llvm-commits mailing list