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

Unified Diff: src/IceInst.cpp

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: 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/IceInst.cpp
diff --git a/src/IceInst.cpp b/src/IceInst.cpp
index f9cfdddf60c13b41771fd4a9fa80dd6d46edd2db..2e449973b7b3eef8bb283eba6748035db7c5dcbe 100644
--- a/src/IceInst.cpp
+++ b/src/IceInst.cpp
@@ -65,9 +65,10 @@ const struct InstFcmpAttributes_ {
// Using non-anonymous struct so that array_lengthof works.
const struct InstIcmpAttributes_ {
const char *DisplayString;
+ InstIcmp::ICond Inverse;
} InstIcmpAttributes[] = {
-#define X(tag, str) \
- { str } \
+#define X(tag, inverse, str) \
+ { str, inverse } \
,
ICEINSTICMP_TABLE
#undef X
@@ -1085,6 +1086,12 @@ void InstTarget::dump(const Cfg *Func) const {
InstBreakpoint::InstBreakpoint(Cfg *Func)
: InstHighLevel(Func, Inst::Breakpoint, 0, nullptr) {}
+void InstIcmp::invertConditionAndSwapOperands() {
+ Condition = InstIcmpAttributes[Condition].Inverse;
+ auto *TempOp = getSrc(0);
Jim Stichnoth 2016/07/10 13:25:32 Since Srcs[] is a protected field that you have ac
manasijm 2016/07/11 22:27:04 Done.
+ replaceSource(0, getSrc(1));
+ replaceSource(1, TempOp);
+}
bool checkForRedundantAssign(const Variable *Dest, const Operand *Source) {
const auto *SrcVar = llvm::dyn_cast<const Variable>(Source);
if (!SrcVar)

Powered by Google App Engine
This is Rietveld 408576698