From f23ae4fbe9287a824f93176afaddab08f07924a9 Mon Sep 17 00:00:00 2001 From: Stanislav Mekhanoshin Date: Wed, 2 Aug 2017 01:18:57 +0000 Subject: [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. llvm-svn: 309779 --- llvm/lib/Target/AMDGPU/SIOptimizeExecMaskingPreRA.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib') diff --git a/llvm/lib/Target/AMDGPU/SIOptimizeExecMaskingPreRA.cpp b/llvm/lib/Target/AMDGPU/SIOptimizeExecMaskingPreRA.cpp index 156c51fcc9e..d54bde49e65 100644 --- a/llvm/lib/Target/AMDGPU/SIOptimizeExecMaskingPreRA.cpp +++ b/llvm/lib/Target/AMDGPU/SIOptimizeExecMaskingPreRA.cpp @@ -138,6 +138,7 @@ bool SIOptimizeExecMaskingPreRA::runOnMachineFunction(MachineFunction &MF) { 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::runOnMachineFunction(MachineFunction &MF) { // 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; -- cgit v1.2.3