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) |