brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 21ada7a Raw
49 lines · plain
1; RUN: llc -mtriple x86_64-- -stop-before peephole-opt -o %t.mir %s2; RUN: llc -mtriple x86_64-- -run-pass none %t.mir -verify-machineinstrs -o - | FileCheck %s3 4; Unreachable blocks in the machine instr representation are these5; weird empty blocks with no successors.6; The MIR printer used to not print empty lists of successors. However,7; the MIR parser now treats non-printed list of successors as "please8; guess it for me". As a result, the parser tries to guess the list of9; successors and given the block is empty, just assumes it falls through10; the next block.11;12; The following test case used to fail the verifier because the false13; path ended up falling through split.true and now, the definition of14; %v does not dominate all its uses.15; Indeed, we go from the following CFG:16;          entry17;         /      \18;    true (def)   false19;        |20;  split.true (use)21;22; To this one:23;          entry24;         /      \25;    true (def)   false26;        |        /  <-- invalid edge27;  split.true (use)28;29; Because of the invalid edge, we get the "def does not30; dominate all uses" error.31;32; CHECK-LABEL: name: foo33; CHECK-LABEL: bb.{{[0-9]+}}.false:34; CHECK-NEXT: successors:35; CHECK-NOT: %bb.{{[0-9]+}}.split.true36; CHECK-LABEL: bb.{{[0-9]+}}.split.true:37define void @foo(ptr %bar) {38  br i1 poison, label %true, label %false39true:40  %v = load i32, ptr %bar41  br label %split.true42false:43  unreachable44split.true:45  %vInc = add i32 %v, 146  store i32 %vInc, ptr %bar47  ret void48}49