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

Unified Diff: src/IceInstX86BaseImpl.h

Issue 2135403002: Subzero: Aggressive LEA (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Revert lea to add when dest and base is same 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/IceInstX86BaseImpl.h
diff --git a/src/IceInstX86BaseImpl.h b/src/IceInstX86BaseImpl.h
index cfc36d44a4fb3827d3329385015dc6de47a9631b..e4ac531fceb59e30b30af9cb7a10416c97c29ed6 100644
--- a/src/IceInstX86BaseImpl.h
+++ b/src/IceInstX86BaseImpl.h
@@ -2025,6 +2025,16 @@ template <typename TraitsType>
void InstImpl<TraitsType>::InstX86Lea::emit(const Cfg *Func) const {
if (!BuildDefs::dump())
return;
+
+ auto *MemOp = llvm::dyn_cast<X86OperandMem>(this->getSrc(0));
+ if (MemOp->getBase()->getRegNum() == this->getDest()->getRegNum() &&
+ MemOp->getIndex() == nullptr && MemOp->getShift() == 0) {
+ auto *Add = InstImpl<TraitsType>::InstX86Add::create(
+ const_cast<Cfg *>(Func), this->getDest(), MemOp->getOffset());
+ Add->emit(Func);
+ return;
+ }
+
Ostream &Str = Func->getContext()->getStrEmit();
assert(this->getSrcSize() == 1);
assert(this->getDest()->hasReg());

Powered by Google App Engine
This is Rietveld 408576698