[llvm] [Mips] Fix mfhi/mflo hazard miscompilation about div and mult (PR #91449)

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 11 20:41:13 PDT 2024


================
@@ -766,17 +769,40 @@ bool MipsBranchExpansion::handleSlot(Pred Predicate, Safe SafeInSlot) {
         if (std::next(Iit) == FI->end() ||
             std::next(Iit)->getOpcode() != Mips::NOP) {
           Changed = true;
-          TII->insertNop(*(I->getParent()), std::next(I), I->getDebugLoc())
-              ->bundleWithPred();
-          NumInsertedNops++;
+          if (Predicate(*I) ||
----------------
yingopq wrote:

I deleted this condition and the test result of ./build/bin/clang --target=mipsel-freestanding -mcpu=mips3 -fomit-frame-pointer -S 4.c -o 1.s` or without `-O3` all are OK, I would update it. Maybe some reasons I added it now I forget. Thanks!

https://github.com/llvm/llvm-project/pull/91449


More information about the llvm-commits mailing list