Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: src/IceTargetLoweringX86BaseImpl.h

Issue 2124973005: Selectively invert ICMP operands for better address optimization (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Move to IceTargetLoweringX86baseImpl.h, Address comments. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/IceTargetLoweringX86BaseImpl.h
diff --git a/src/IceTargetLoweringX86BaseImpl.h b/src/IceTargetLoweringX86BaseImpl.h
index a9dc7a7e75496b3d28fb654c2188c7b6cc2ed0da..e6e824da196864ad46b4caf2016954b9dd9e5364 100644
--- a/src/IceTargetLoweringX86BaseImpl.h
+++ b/src/IceTargetLoweringX86BaseImpl.h
@@ -5652,6 +5652,39 @@ void TargetX86Base<TraitsType>::lowerLoad(const InstLoad *Load) {
}
template <typename TraitsType>
+void TargetX86Base<TraitsType>::doAddressOptOther() {
+ return;
Jim Stichnoth 2016/07/08 11:45:46 wat ?
manasijm 2016/07/08 18:11:40 Sorry, remnant of testing with this turned off.
+ // Inverts some Icmp instructions which helps doAddressOptLoad later.
+ Inst *Instr = Context.getCur();
+ auto *VMetadata = Func->getVMetadata();
+ if (auto *Icmp = llvm::dyn_cast<InstIcmp>(Instr)) {
+ if (llvm::isa<Constant>(Icmp->getSrc(0)) ||
+ llvm::isa<Constant>(Icmp->getSrc(1)))
+ return;
+ auto *Var0 = llvm::dyn_cast<Variable>(Icmp->getSrc(0));
+ if (Var0 == nullptr)
+ return;
+ if (!VMetadata->isTracked(Var0))
+ return;
+ auto *Op0Def = VMetadata->getFirstDefinitionSingleBlock(Var0);
+ if (Op0Def == nullptr || !llvm::isa<InstLoad>(Op0Def))
+ return;
+ if (VMetadata->getLocalUseNode(Var0) != Context.getNode())
+ return;
+
+ auto *Var1 = llvm::dyn_cast<Variable>(Icmp->getSrc(1));
+ if (Var1 != nullptr && VMetadata->isTracked(Var1)) {
+ auto *Op1Def = VMetadata->getFirstDefinitionSingleBlock(Var1);
+ if (Op1Def != nullptr && !VMetadata->isMultiBlock(Var1) &&
+ llvm::isa<InstLoad>(Op1Def)) {
+ return; // Both are loads
+ }
+ }
+ Icmp->invert();
+ }
+}
+
+template <typename TraitsType>
void TargetX86Base<TraitsType>::doAddressOptLoad() {
Inst *Instr = Context.getCur();
Operand *Addr = Instr->getSrc(0);

Powered by Google App Engine
This is Rietveld 408576698