Subzero: Render constants in dump() to be more like LLVM. Integers are generally dumped as signed instead of unsigned values. Integers of i1 type are dumped as 'false' and 'true'. Floating point values still don't match LLVM. BUG= none R=kschimpf@google.com Review URL: https://codereview.chromium.org/539743002
diff --git a/src/IceConverter.cpp b/src/IceConverter.cpp index 8dcfce4..ca73a8b 100644 --- a/src/IceConverter.cpp +++ b/src/IceConverter.cpp
@@ -103,7 +103,7 @@ GV->getName()); } else if (const ConstantInt *CI = dyn_cast<ConstantInt>(Const)) { return Ctx->getConstantInt(convertToIceType(CI->getType()), - CI->getZExtValue()); + CI->getSExtValue()); } else if (const ConstantFP *CFP = dyn_cast<ConstantFP>(Const)) { Ice::Type Type = convertToIceType(CFP->getType()); if (Type == Ice::IceType_f32) @@ -497,7 +497,7 @@ unsigned CurrentCase = 0; for (SwitchInst::ConstCaseIt I = Inst->case_begin(), E = Inst->case_end(); I != E; ++I, ++CurrentCase) { - uint64_t CaseValue = I.getCaseValue()->getZExtValue(); + uint64_t CaseValue = I.getCaseValue()->getSExtValue(); Ice::CfgNode *CaseSuccessor = mapBasicBlockToNode(I.getCaseSuccessor()); Switch->addBranch(CurrentCase, CaseValue, CaseSuccessor); }