Commit a4c20f94 authored by nagayama15's avatar nagayama15

オペランドスワップの条件が間違っていたのを修正

parent 4db13b7b
...@@ -83,16 +83,17 @@ namespace ...@@ -83,16 +83,17 @@ namespace
for (auto& inst : block) for (auto& inst : block)
{ {
if (auto bin_op = llvm::dyn_cast<llvm::BinaryOperator>(&inst)) if (auto bin_op = llvm::dyn_cast<llvm::BinaryOperator>(&inst); bin_op && bin_op->isCommutative())
{ {
if (bit_stream_->read_bit()) if (bit_stream_->read_bit())
{ {
is_changed = !bin_op->swapOperands() || is_changed; bin_op->swapOperands();
is_changed = true;
} }
num_embedded_bits += 1; num_embedded_bits += 1;
} }
else if (auto cmp_inst = llvm::dyn_cast<llvm::CmpInst>(&inst)) else if (auto cmp_inst = llvm::dyn_cast<llvm::CmpInst>(&inst); cmp_inst)
{ {
if (bit_stream_->read_bit()) if (bit_stream_->read_bit())
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment