[llvm] r275331 - [MI] Fix MachineInstr::isInvariantLoad.

Justin Lebar via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 13 15:34:51 PDT 2016


Author: jlebar
Date: Wed Jul 13 17:34:50 2016
New Revision: 275331

URL: http://llvm.org/viewvc/llvm-project?rev=275331&view=rev
Log:
[MI] Fix MachineInstr::isInvariantLoad.

Summary:
Previously it would say we had an invariant load if any of the memory
operands were invariant.  But the load should be invariant only if *all*
the memory operands are invariant.

No testcase because this has proven to be very difficult to tickle in
practice.  As just one example, ARM's ldrd instruction, which loads 64
bits into two 32-bit regs, is theoretically affected by this.  But when
it's produced, it loses its memoperands' invariance bits!

Reviewers: jfb

Subscribers: llvm-commits, aemerson

Differential Revision: http://reviews.llvm.org/D22318

Modified:
    llvm/trunk/lib/CodeGen/MachineInstr.cpp

Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=275331&r1=275330&r2=275331&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Wed Jul 13 17:34:50 2016
@@ -1585,8 +1585,7 @@ bool MachineInstr::isInvariantLoad(Alias
        E = memoperands_end(); I != E; ++I) {
     if ((*I)->isVolatile()) return false;
     if ((*I)->isStore()) return false;
-    if ((*I)->isInvariant()) return true;
-
+    if ((*I)->isInvariant()) continue;
 
     // A load from a constant PseudoSourceValue is invariant.
     if (const PseudoSourceValue *PSV = (*I)->getPseudoValue())




More information about the llvm-commits mailing list