[PATCH] D91401: [AMDGPU] Mark sin/cos load folding as modifying the function.
Stanislav Mekhanoshin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 13 14:49:46 PST 2020
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc9821cec7492: [AMDGPU] Mark sin/cos load folding as modifying the function. (authored by rampitec).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D91401/new/
https://reviews.llvm.org/D91401
Files:
llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
Index: llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
@@ -1288,6 +1288,7 @@
BasicBlock * const CBB = CI->getParent();
int const MaxScan = 30;
+ bool Changed = false;
{ // fold in load value.
LoadInst *LI = dyn_cast<LoadInst>(CArgVal);
@@ -1295,6 +1296,7 @@
BasicBlock::iterator BBI = LI->getIterator();
Value *AvailableVal = FindAvailableLoadedValue(LI, CBB, BBI, MaxScan, AA);
if (AvailableVal) {
+ Changed = true;
CArgVal->replaceAllUsesWith(AvailableVal);
if (CArgVal->getNumUses() == 0)
LI->eraseFromParent();
@@ -1330,7 +1332,8 @@
if (UI) break;
}
- if (!UI) return false;
+ if (!UI)
+ return Changed;
// Merge the sin and cos.
@@ -1339,7 +1342,8 @@
AMDGPULibFunc nf(AMDGPULibFunc::EI_SINCOS, fInfo);
nf.getLeads()[0].PtrKind = AMDGPULibFunc::getEPtrKindFromAddrSpace(AMDGPUAS::FLAT_ADDRESS);
FunctionCallee Fsincos = getFunction(M, nf);
- if (!Fsincos) return false;
+ if (!Fsincos)
+ return Changed;
BasicBlock::iterator ItOld = B.GetInsertPoint();
AllocaInst *Alloc = insertAlloca(UI, B, "__sincos_");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91401.305271.patch
Type: text/x-patch
Size: 1285 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201113/b2195914/attachment.bin>
More information about the llvm-commits
mailing list