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/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: Add TODO 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 3a07b52e4f97a755a6249f0ac1e1691332483941..92ab0b6a9bd66c8ebf2ebcac59aa64d5bbcfd90d 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 Reverse;
} InstIcmpAttributes[] = {
-#define X(tag, str) \
- { str } \
+#define X(tag, reverse, str) \
+ { str, reverse } \
,
ICEINSTICMP_TABLE
#undef X
@@ -1085,6 +1086,10 @@ void InstTarget::dump(const Cfg *Func) const {
InstBreakpoint::InstBreakpoint(Cfg *Func)
: InstHighLevel(Func, Inst::Breakpoint, 0, nullptr) {}
+void InstIcmp::reverseConditionAndOperands() {
+ Condition = InstIcmpAttributes[Condition].Reverse;
+ std::swap(Srcs[0], Srcs[1]);
+}
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