Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
Show First 20 Lines • Show All 2,389 Lines • ▼ Show 20 Lines | Instruction *InstCombinerImpl::optimizeBitCastFromPhi(CastInst &CI, | ||||
OldPhiNodes.insert(PN); | OldPhiNodes.insert(PN); | ||||
while (!PhiWorklist.empty()) { | while (!PhiWorklist.empty()) { | ||||
auto *OldPN = PhiWorklist.pop_back_val(); | auto *OldPN = PhiWorklist.pop_back_val(); | ||||
for (Value *IncValue : OldPN->incoming_values()) { | for (Value *IncValue : OldPN->incoming_values()) { | ||||
if (isa<Constant>(IncValue)) | if (isa<Constant>(IncValue)) | ||||
continue; | continue; | ||||
if (auto *LI = dyn_cast<LoadInst>(IncValue)) { | if (auto *LI = dyn_cast<LoadInst>(IncValue)) { | ||||
// Don't transform "load <256 x i32>, <256 x i32>*" to | |||||
pengfei: Better to add a comment for the reason. | |||||
// "load x86_amx, x86_amx*", because we don't have a corresponding | |||||
// instruction to load x86_amx. Doing the transform causes trouble | |||||
// to lower "load x86_amx" instruction in backend. | |||||
if (DestTy->isX86_AMXTy()) | |||||
return nullptr; | |||||
// If there is a sequence of one or more load instructions, each loaded | // If there is a sequence of one or more load instructions, each loaded | ||||
// value is used as address of later load instruction, bitcast is | // value is used as address of later load instruction, bitcast is | ||||
// necessary to change the value type, don't optimize it. For | // necessary to change the value type, don't optimize it. For | ||||
// simplicity we give up if the load address comes from another load. | // simplicity we give up if the load address comes from another load. | ||||
Value *Addr = LI->getOperand(0); | Value *Addr = LI->getOperand(0); | ||||
if (Addr == &CI || isa<LoadInst>(Addr)) | if (Addr == &CI || isa<LoadInst>(Addr)) | ||||
return nullptr; | return nullptr; | ||||
if (LI->hasOneUse() && LI->isSimple()) | if (LI->hasOneUse() && LI->isSimple()) | ||||
▲ Show 20 Lines • Show All 331 Lines • Show Last 20 Lines |
Better to add a comment for the reason.