[llvm-commits] [llvm] r141689 - in /llvm/trunk: lib/CodeGen/MachineLICM.cpp test/CodeGen/ARM/lsr-unfolded-offset.ll test/CodeGen/X86/licm-dominance.ll test/CodeGen/X86/licm-nested.ll test/CodeGen/X86/sink-hoist.ll

Devang Patel dpatel at apple.com
Thu Oct 13 10:37:10 PDT 2011


On Oct 12, 2011, at 7:24 PM, Nick Lewycky wrote:

> Note that two instructions were removed. A build with clang -O1 produces this valgrind error on the same testcase:
> 
> ==12757== Conditional jump or move depends on uninitialised value(s)
> ==12757==    at 0x80BAB6: (anonymous namespace)::PeepholeOptimizer::runOnMachineFunction(llvm::MachineFunction&) (third_party/llvm/llvm/lib/CodeGen/PeepholeOptimizer.cpp:138)
> ==12757==    by 0x80D482: llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (third_party/llvm/llvm/lib/CodeGen/MachineFunctionPass.cpp:33)
> ==12757==    by 0x9C0549: llvm::FPPassManager::runOnFunction(llvm::Function&) (third_party/llvm/llvm/lib/VMCore/PassManager.cpp:1512)
> ==12757==    by 0x9C07FA: llvm::FPPassManager::runOnModule(llvm::Module&) (third_party/llvm/llvm/lib/VMCore/PassManager.cpp:1534)
> ==12757==    by 0x9C099D: llvm::MPPassManager::runOnModule(llvm::Module&) (third_party/llvm/llvm/lib/VMCore/PassManager.cpp:1588)
> ==12757==    by 0x9C0E74: llvm::PassManagerImpl::run(llvm::Module&) (third_party/llvm/llvm/lib/VMCore/PassManager.cpp:1672)
> ==12757==    by 0x9C133C: llvm::PassManager::run(llvm::Module&) (third_party/llvm/llvm/lib/VMCore/PassManager.cpp:1716)
> ==12757==    by 0x4E6EBF: main (third_party/llvm/llvm/tools/llc/llc.cpp:374)
> 
> but doing anything (ie., errs() << "this: " << this;) will cause the error to go away. I can't find anything wrong with your commit, or the code that valgrind is pointing to, but I'm hoping that you or someone on the list will be able to help track it down...

At PeepholeOptimizer.cpp:138, I see

bool PeepholeOptimizer::
OptimizeExtInstr(MachineInstr *MI, MachineBasicBlock *MBB,
                 SmallPtrSet<MachineInstr*, 8> &LocalMIs) {
  unsigned SrcReg, DstReg, SubIdx;
  if (!TII->isCoalescableExtInstr(*MI, SrcReg, DstReg, SubIdx))
    return false;

  if (TargetRegisterInfo::isPhysicalRegister(DstReg) ||


Are you sure DstReg is always initialized for all targets by isCoalescableExtInstr ?  I have not checked.
-
Devang



More information about the llvm-commits mailing list