[PATCH] D36772: Unmerge GEPs to reduce register pressure on IndirectBr edges.
Hal Finkel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 2 14:26:40 PDT 2017
hfinkel added a comment.
This is looking good. A couple additional things...
================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:6224
+ // that SrcBlock is the only precedessor of it. If not, give up.
+ if (UI->getParent()->getSinglePredecessor() != SrcBlock)
+ return false;
----------------
I don't think this check is necessary. GEPIOp is constrained to be defined in SrcBlock, and it's SrcBlock that has the IndirectBr terminator, so *any* use of GEPIOp outside of SrcBlock keeps it live over the indirect edge. I don't see why we wouldn't unmerge regardless of the parent block here.
================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:6264
+ UGEPI->setOperand(1, NewUGEPIIdx);
+ }
+ // After unmerging, verify that GEPIOp is actually only used in SrcBlock (not
----------------
You'll also need to make sure that this GEP is not marked as inbounds if GEPI was not.
if (!GEPI->isInBounds()) {
UGEPI->setIsInBounds(false);
}
because otherwise the result of GEP could be not-in-bounds resulting in UB if that's used as the input to an inbounds UGEPI.
https://reviews.llvm.org/D36772
More information about the llvm-commits
mailing list