Index: lib/CodeGen/RegAllocGreedy.cpp =================================================================== --- lib/CodeGen/RegAllocGreedy.cpp +++ lib/CodeGen/RegAllocGreedy.cpp @@ -726,7 +726,7 @@ if (Matrix->checkInterference(VirtReg, PhysReg) > LiveRegMatrix::IK_VirtReg) return false; - bool IsLocal = LIS->intervalIsInOneMBB(VirtReg); + bool IsLocal = VirtReg.empty() || LIS->intervalIsInOneMBB(VirtReg); // Find VirtReg's cascade number. This will be unassigned if VirtReg was never // involved in an eviction before. If a cascade number was assigned, deny Index: test/CodeGen/AMDGPU/branch-on-undef.ll =================================================================== --- /dev/null +++ test/CodeGen/AMDGPU/branch-on-undef.ll @@ -0,0 +1,14 @@ +; RUN: llc -march=amdgcn -verify-machineinstrs < %s + +define void @undef_br(i32 addrspace(1)* %ptr) nounwind { +entry: + br i1 undef, label %exit, label %bb + +bb: + store volatile i32 0, i32 addrspace(1)* %ptr + br label %exit + +exit: + ret void +} +