[llvm-bugs] [Bug 42162] New: TailDuplicator uses result of failed analyzeBranch call

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 6 07:27:01 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42162

            Bug ID: 42162
           Summary: TailDuplicator uses result of failed analyzeBranch
                    call
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: Matthew.Arsenault at amd.com
                CC: llvm-bugs at lists.llvm.org

TailDuplicator::tailDuplicate currently uses the result of a failed
analyzeBranch call. canTailDuplicate checks that PredBB can be analyzed, but
this isn't sufficient. After the tail block is cloned into PredBB,
analyzeBranch is called again and not checked. Adding an assert to catch this
fails in these testcases:

    LLVM :: CodeGen/AArch64/addsub-shifted.ll
    LLVM :: CodeGen/AArch64/and-sink.ll
    LLVM :: CodeGen/AArch64/arm64-addr-mode-folding.ll
    LLVM :: CodeGen/AArch64/arm64-addr-type-promotion.ll
    LLVM :: CodeGen/AArch64/arm64-andCmpBrToTBZ.ll
    LLVM :: CodeGen/AArch64/arm64-atomic-128.ll
    LLVM :: CodeGen/AArch64/arm64-atomic.ll
    LLVM :: CodeGen/AArch64/arm64-bitfield-extract.ll
    LLVM :: CodeGen/AArch64/arm64-ccmp.ll
    LLVM :: CodeGen/AArch64/arm64-cse.ll
    LLVM :: CodeGen/AArch64/arm64-neon-vector-list-spill.ll
    LLVM :: CodeGen/AArch64/arm64-shrink-wrapping.ll
    LLVM :: CodeGen/AArch64/atomic-ops-not-barriers.ll
    LLVM :: CodeGen/AArch64/atomic-ops.ll
    LLVM :: CodeGen/AArch64/cmpxchg-idioms.ll
    LLVM :: CodeGen/AArch64/combine-comparisons-by-cse.ll
    LLVM :: CodeGen/AArch64/fast-isel-switch-phi.ll
    LLVM :: CodeGen/AArch64/free-zext.ll
    LLVM :: CodeGen/AArch64/ldst-opt.ll
    LLVM :: CodeGen/AArch64/machine-copy-remove.ll
    LLVM :: CodeGen/AArch64/pic-eh-stubs.ll
    LLVM :: CodeGen/AArch64/redundant-copy-elim-empty-mbb.ll
    LLVM :: CodeGen/AArch64/speculation-hardening-dagisel.ll
    LLVM :: CodeGen/AArch64/swap-compare-operands.ll
    LLVM :: CodeGen/AArch64/switch-unreachable-default.ll
    LLVM :: CodeGen/AArch64/tbz-tbnz.ll
    LLVM :: CodeGen/AMDGPU/GlobalISel/xxx-combine-extract-insert.mir
    LLVM :: CodeGen/AMDGPU/fneg-combines.ll
    LLVM :: CodeGen/AMDGPU/gv-const-addrspace.ll
    LLVM :: CodeGen/AMDGPU/indirect-addressing-si.ll
    LLVM :: CodeGen/AMDGPU/llvm.amdgcn.groupstaticsize.ll
    LLVM :: CodeGen/AMDGPU/mul_int24.ll
    LLVM :: CodeGen/AMDGPU/multi-divergent-exit-region.ll
    LLVM :: CodeGen/AMDGPU/uniform-cfg.ll
    LLVM :: CodeGen/AMDGPU/vop-shrink.ll
    LLVM :: CodeGen/ARM/2010-03-04-eabi-fp-spill.ll
    LLVM :: CodeGen/ARM/2010-10-25-ifcvt-ldm.ll
    LLVM :: CodeGen/ARM/2011-04-11-MachineLICMBug.ll
    LLVM :: CodeGen/ARM/2011-08-25-ldmia_ret.ll
    LLVM :: CodeGen/ARM/2013-05-05-IfConvertBug.ll
    LLVM :: CodeGen/ARM/CGP/arm-cgp-casts.ll
    LLVM :: CodeGen/ARM/CGP/arm-cgp-switch.ll
    LLVM :: CodeGen/ARM/GlobalISel/arm-isel.ll
    LLVM :: CodeGen/ARM/ParallelDSP/multi-use-loads.ll
    LLVM :: CodeGen/ARM/Windows/dbzchk.ll
    LLVM :: CodeGen/ARM/add-like-or.ll
    LLVM :: CodeGen/ARM/arm-and-tst-peephole.ll
    LLVM :: CodeGen/ARM/arm-shrink-wrapping-linux.ll
    LLVM :: CodeGen/ARM/arm-shrink-wrapping.ll
    LLVM :: CodeGen/ARM/arm-ttype-target2.ll
    LLVM :: CodeGen/ARM/atomic-cmp.ll
    LLVM :: CodeGen/ARM/atomic-cmpxchg.ll
    LLVM :: CodeGen/ARM/atomic-op.ll
    LLVM :: CodeGen/ARM/atomic-ops-v8.ll
    LLVM :: CodeGen/ARM/avoid-cpsr-rmw.ll
    LLVM :: CodeGen/ARM/cmn.ll
    LLVM :: CodeGen/ARM/cmpxchg-idioms.ll
    LLVM :: CodeGen/ARM/cmpxchg-weak.ll
    LLVM :: CodeGen/ARM/coalesce-subregs.ll
    LLVM :: CodeGen/ARM/code-placement.ll
    LLVM :: CodeGen/ARM/cse-ldrlit.ll
    LLVM :: CodeGen/ARM/data-in-code-annotations.ll
    LLVM :: CodeGen/ARM/debug-frame.ll
    LLVM :: CodeGen/ARM/execute-only.ll
    LLVM :: CodeGen/ARM/hoist-and-by-const-from-lshr-in-eqcmp-zero.ll
    LLVM :: CodeGen/ARM/hoist-and-by-const-from-shl-in-eqcmp-zero.ll
    LLVM :: CodeGen/ARM/ifcvt11.ll
    LLVM :: CodeGen/ARM/indirectbr.ll
    LLVM :: CodeGen/ARM/intrinsics-overflow.ll
    LLVM :: CodeGen/ARM/invalidated-save-point.ll
    LLVM :: CodeGen/ARM/jump-table-islands-split.ll
    LLVM :: CodeGen/ARM/jump-table-tbh.ll
    LLVM :: CodeGen/ARM/jumptable-label.ll
    LLVM :: CodeGen/ARM/lsr-icmp-imm.ll
    LLVM :: CodeGen/ARM/misched-copy-arm.ll
    LLVM :: CodeGen/ARM/msr-it-block.ll
    LLVM :: CodeGen/ARM/pr25838.ll
    LLVM :: CodeGen/ARM/select-imm.ll
    LLVM :: CodeGen/ARM/shift-combine.ll
    LLVM :: CodeGen/ARM/tail-dup.ll
    LLVM :: CodeGen/ARM/tail-merge-branch-weight.ll
    LLVM :: CodeGen/ARM/tail-opts.ll
    LLVM :: CodeGen/ARM/taildup-branch-weight.ll
    LLVM :: CodeGen/ARM/thumb-alignment.ll
    LLVM :: CodeGen/ARM/wide-compares.ll
    LLVM :: CodeGen/BPF/sockex2.ll
    LLVM :: CodeGen/Generic/2006-02-12-InsertLibcall.ll
    LLVM :: CodeGen/Generic/2006-06-28-SimplifySetCCCrash.ll
    LLVM :: CodeGen/Generic/MachineBranchProb.ll
    LLVM :: CodeGen/Generic/builtin-expect.ll
    LLVM :: CodeGen/Generic/pr12507.ll
    LLVM :: CodeGen/Generic/undef-phi.ll
    LLVM :: CodeGen/Hexagon/adjust-latency-stackST.ll
    LLVM :: CodeGen/Hexagon/align_test.ll
    LLVM :: CodeGen/Hexagon/blockaddr-fpic.ll
    LLVM :: CodeGen/Hexagon/cext-check.ll
    LLVM :: CodeGen/Hexagon/cfgopt-fall-through.ll
    LLVM :: CodeGen/Hexagon/cmp_pred2.ll
    LLVM :: CodeGen/Hexagon/const-combine.ll
    LLVM :: CodeGen/Hexagon/constext-replace.ll
    LLVM :: CodeGen/Hexagon/dag-indexed.ll
    LLVM :: CodeGen/Hexagon/early-if-phi-i1.ll
    LLVM :: CodeGen/Hexagon/expand-condsets-undefvni.ll
    LLVM :: CodeGen/Hexagon/float-gen-cmpop.ll
    LLVM :: CodeGen/Hexagon/hwloop-preh.ll
    LLVM :: CodeGen/Hexagon/hwloop2.ll
    LLVM :: CodeGen/Hexagon/hwloop5.ll
    LLVM :: CodeGen/Hexagon/jump-table-isel.ll
    LLVM :: CodeGen/Hexagon/memcmp.ll
    LLVM :: CodeGen/Hexagon/misched-top-rptracker-sync.ll
    LLVM :: CodeGen/Hexagon/newvaluejump-postinc.ll
    LLVM :: CodeGen/Hexagon/newvaluejump.ll
    LLVM :: CodeGen/Hexagon/newvaluejump2.ll
    LLVM :: CodeGen/Hexagon/opt-glob-addrs-003.ll
    LLVM :: CodeGen/Hexagon/pic-jt-big.ll
    LLVM :: CodeGen/Hexagon/pred-gp.ll
    LLVM :: CodeGen/Hexagon/rdf-copy.ll
    LLVM :: CodeGen/Hexagon/rdf-def-mask.ll
    LLVM :: CodeGen/Hexagon/rdf-multiple-phis-up.ll
    LLVM :: CodeGen/Hexagon/rdf-phi-up.ll
    LLVM :: CodeGen/Hexagon/shrink-frame-basic.ll
    LLVM :: CodeGen/Hexagon/vect/zext-v4i1.ll
    LLVM :: CodeGen/Hexagon/verify-undef.ll
    LLVM :: CodeGen/MSP430/indirectbr.ll
    LLVM :: CodeGen/MSP430/indirectbr2.ll
    LLVM :: CodeGen/MSP430/select-use-sr.ll
    LLVM :: CodeGen/Mips/assertzext-trunc.ll
    LLVM :: CodeGen/Mips/blez_bgez.ll
    LLVM :: CodeGen/Mips/brdelayslot.ll
    LLVM :: CodeGen/Mips/brind-tailcall.ll
    LLVM :: CodeGen/Mips/dsp-r1.ll
    LLVM :: CodeGen/Mips/jtstat.ll
    LLVM :: CodeGen/Mips/lcb2.ll
    LLVM :: CodeGen/Mips/lcb5.ll
    LLVM :: CodeGen/Mips/llvm-ir/ashr.ll
    LLVM :: CodeGen/Mips/llvm-ir/lshr.ll
    LLVM :: CodeGen/Mips/llvm-ir/select-dbl.ll
    LLVM :: CodeGen/Mips/llvm-ir/select-flt.ll
    LLVM :: CodeGen/Mips/llvm-ir/shl.ll
    LLVM :: CodeGen/Mips/llvm-ir/sqrt.ll
    LLVM :: CodeGen/Mips/micromips-not16.ll
    LLVM :: CodeGen/Mips/optimize-fp-math.ll
    LLVM :: CodeGen/Mips/pr35071.ll
    LLVM :: CodeGen/Mips/pseudo-jump-fill.ll
    LLVM :: CodeGen/Mips/selpat.ll
    LLVM :: CodeGen/PowerPC/2016-01-07-BranchWeightCrash.ll
    LLVM :: CodeGen/PowerPC/BoolRetToIntTest-2.ll
    LLVM :: CodeGen/PowerPC/atomic-1.ll
    LLVM :: CodeGen/PowerPC/atomic-2.ll
    LLVM :: CodeGen/PowerPC/atomics-regression.ll
    LLVM :: CodeGen/PowerPC/atomics.ll
    LLVM :: CodeGen/PowerPC/early-ret.ll
    LLVM :: CodeGen/PowerPC/expand-isel.ll
    LLVM :: CodeGen/PowerPC/fp-to-int-to-fp.ll
    LLVM :: CodeGen/PowerPC/indirectbr.ll
    LLVM :: CodeGen/PowerPC/opt-cmp-inst-cr0-live.ll
    LLVM :: CodeGen/PowerPC/pow.75.ll
    LLVM :: CodeGen/PowerPC/ppc-ctr-dead-code.ll
    LLVM :: CodeGen/PowerPC/ppc-shrink-wrapping.ll
    LLVM :: CodeGen/PowerPC/pr24546.ll
    LLVM :: CodeGen/PowerPC/preincprep-i64-check.ll
    LLVM :: CodeGen/PowerPC/select-i1-vs-i1.ll
    LLVM :: CodeGen/PowerPC/select_const.ll
    LLVM :: CodeGen/PowerPC/xray-ret-is-terminator.ll
    LLVM :: CodeGen/PowerPC/zext-and-cmp.ll
    LLVM :: CodeGen/SPARC/2011-01-11-CC.ll
    LLVM :: CodeGen/SPARC/2011-01-19-DelaySlot.ll
    LLVM :: CodeGen/SPARC/exception.ll
    LLVM :: CodeGen/SPARC/select-mask.ll
    LLVM :: CodeGen/SystemZ/branch-05.ll
    LLVM :: CodeGen/SystemZ/branch-11.ll
    LLVM :: CodeGen/SystemZ/fp-conv-08.ll
    LLVM :: CodeGen/SystemZ/fp-conv-10.ll
    LLVM :: CodeGen/SystemZ/fp-conv-12.ll
    LLVM :: CodeGen/SystemZ/fp-copysign-02.ll
    LLVM :: CodeGen/SystemZ/int-cmp-52.ll
    LLVM :: CodeGen/SystemZ/memcmp-nobuiltin.ll
    LLVM :: CodeGen/Thumb/2009-12-17-pre-regalloc-taildup.ll
    LLVM :: CodeGen/Thumb/consthoist-imm8-costs-1.ll
    LLVM :: CodeGen/Thumb/i8-phi-ext.ll
    LLVM :: CodeGen/Thumb/large-fn-switch.ll
    LLVM :: CodeGen/Thumb/select.ll
    LLVM :: CodeGen/Thumb/thumb-shrink-wrapping.ll
    LLVM :: CodeGen/Thumb/tst_teq.ll
    LLVM :: CodeGen/Thumb/unord.ll
    LLVM :: CodeGen/Thumb2/2009-08-04-ScavengerAssert.ll
    LLVM :: CodeGen/Thumb2/2010-01-06-TailDuplicateLabels.ll
    LLVM :: CodeGen/Thumb2/2010-06-21-TailMergeBug.ll
    LLVM :: CodeGen/Thumb2/cbnz.ll
    LLVM :: CodeGen/Thumb2/constant-hoisting.ll
    LLVM :: CodeGen/Thumb2/constant-islands-cbz.ll
    LLVM :: CodeGen/Thumb2/ifcvt-compare.ll
    LLVM :: CodeGen/Thumb2/ifcvt-minsize.ll
    LLVM :: CodeGen/Thumb2/ifcvt-rescan-bug-2016-08-22.ll
    LLVM :: CodeGen/Thumb2/ldr-str-imm12.ll
    LLVM :: CodeGen/Thumb2/v8_IT_4.ll
    LLVM :: CodeGen/WebAssembly/conv-trap.ll
    LLVM :: CodeGen/WebAssembly/implicit-def.ll
    LLVM :: CodeGen/WebAssembly/mem-intrinsics.ll
    LLVM :: CodeGen/WebAssembly/simd-conversions.ll
    LLVM :: CodeGen/WebAssembly/stack-insts.ll
    LLVM :: CodeGen/WebAssembly/switch.ll
    LLVM :: CodeGen/X86/2006-11-27-SelectLegalize.ll
    LLVM :: CodeGen/X86/2007-05-05-Personality.ll
    LLVM :: CodeGen/X86/2008-04-09-BranchFolding.ll
    LLVM :: CodeGen/X86/2009-01-16-SchedulerBug.ll
    LLVM :: CodeGen/X86/2009-02-08-CoalescerBug.ll
    LLVM :: CodeGen/X86/2009-08-06-branchfolder-crash.ll
    LLVM :: CodeGen/X86/GlobalISel/brcond.ll
    LLVM :: CodeGen/X86/GlobalISel/phi.ll
    LLVM :: CodeGen/X86/MachineSink-SubReg.ll
    LLVM :: CodeGen/X86/absolute-bit-mask.ll
    LLVM :: CodeGen/X86/absolute-bt.ll
    LLVM :: CodeGen/X86/addr-mode-matcher.ll
    LLVM :: CodeGen/X86/atom-cmpb.ll
    LLVM :: CodeGen/X86/atom-fixup-lea1.ll
    LLVM :: CodeGen/X86/atomic-unordered.ll
    LLVM :: CodeGen/X86/avx-brcond.ll
    LLVM :: CodeGen/X86/avx512-cmp.ll
    LLVM :: CodeGen/X86/avx512-mask-op.ll
    LLVM :: CodeGen/X86/brcond.ll
    LLVM :: CodeGen/X86/break-false-dep.ll
    LLVM :: CodeGen/X86/bt.ll
    LLVM :: CodeGen/X86/bypass-slow-division-32.ll
    LLVM :: CodeGen/X86/bypass-slow-division-64.ll
    LLVM :: CodeGen/X86/bypass-slow-division-tune.ll
    LLVM :: CodeGen/X86/cgp-usubo.ll
    LLVM :: CodeGen/X86/clz.ll
    LLVM :: CodeGen/X86/cmov-into-branch.ll
    LLVM :: CodeGen/X86/cmovcmov.ll
    LLVM :: CodeGen/X86/condbr_switch.ll
    LLVM :: CodeGen/X86/conditional-tailcall.ll
    LLVM :: CodeGen/X86/constant-hoisting-and.ll
    LLVM :: CodeGen/X86/constant-hoisting-cmp.ll
    LLVM :: CodeGen/X86/constant-hoisting-shift-immediate.ll
    LLVM :: CodeGen/X86/crash.ll
    LLVM :: CodeGen/X86/dagcombine-select.ll
    LLVM :: CodeGen/X86/debug-nodebug-crash.ll
    LLVM :: CodeGen/X86/eh-label.ll
    LLVM :: CodeGen/X86/exception-label.ll
    LLVM :: CodeGen/X86/fast-isel-select-pseudo-cmov.ll
    LLVM :: CodeGen/X86/fdiv-combine.ll
    LLVM :: CodeGen/X86/fold-load.ll
    LLVM :: CodeGen/X86/fp-une-cmp.ll
    LLVM :: CodeGen/X86/fp128-select.ll
    LLVM :: CodeGen/X86/gpr-to-mask.ll
    LLVM :: CodeGen/X86/indirect-branch-tracking.ll
    LLVM :: CodeGen/X86/indirect-hidden.ll
    LLVM :: CodeGen/X86/lea-opt.ll
    LLVM :: CodeGen/X86/load-local-v3i1.ll
    LLVM :: CodeGen/X86/loop-search.ll
    LLVM :: CodeGen/X86/lsr-negative-stride.ll
    LLVM :: CodeGen/X86/lzcnt.ll
    LLVM :: CodeGen/X86/machine-cp.ll
    LLVM :: CodeGen/X86/machine-sink.ll
    LLVM :: CodeGen/X86/masked_load.ll
    LLVM :: CodeGen/X86/masked_store.ll
    LLVM :: CodeGen/X86/memcmp-optsize.ll
    LLVM :: CodeGen/X86/memcmp.ll
    LLVM :: CodeGen/X86/misched-balance.ll
    LLVM :: CodeGen/X86/mul-constant-result.ll
    LLVM :: CodeGen/X86/nosse-varargs.ll
    LLVM :: CodeGen/X86/personality.ll
    LLVM :: CodeGen/X86/personality_size.ll
    LLVM :: CodeGen/X86/phi-bit-propagation.ll
    LLVM :: CodeGen/X86/phi-immediate-factoring.ll
    LLVM :: CodeGen/X86/pr13209.ll
    LLVM :: CodeGen/X86/pre-coalesce.ll
    LLVM :: CodeGen/X86/pseudo_cmov_lower.ll
    LLVM :: CodeGen/X86/reghinting.ll
    LLVM :: CodeGen/X86/retpoline.ll
    LLVM :: CodeGen/X86/rtm.ll
    LLVM :: CodeGen/X86/scalar-int-to-fp.ll
    LLVM :: CodeGen/X86/segmented-stacks.ll
    LLVM :: CodeGen/X86/select.ll
    LLVM :: CodeGen/X86/select_const.ll
    LLVM :: CodeGen/X86/select_meta.ll
    LLVM :: CodeGen/X86/setuge.ll
    LLVM :: CodeGen/X86/shrink-compare.ll
    LLVM :: CodeGen/X86/sink-hoist.ll
    LLVM :: CodeGen/X86/sse-scalar-fp-arith.ll
    LLVM :: CodeGen/X86/sttni.ll
    LLVM :: CodeGen/X86/switch-bt.ll
    LLVM :: CodeGen/X86/switch-jump-table.ll
    LLVM :: CodeGen/X86/tail-merge-after-mbp.mir
    LLVM :: CodeGen/X86/tail-opts.ll
    LLVM :: CodeGen/X86/tail-threshold.ll
    LLVM :: CodeGen/X86/test-shrink.ll
    LLVM :: CodeGen/X86/testb-je-fusion.ll
    LLVM :: CodeGen/X86/token_landingpad.ll
    LLVM :: CodeGen/X86/uint64-to-float.ll
    LLVM :: CodeGen/X86/urem-seteq-optsize.ll
    LLVM :: CodeGen/X86/vec_floor.ll
    LLVM :: CodeGen/X86/vec_int_to_fp-widen.ll
    LLVM :: CodeGen/X86/vec_int_to_fp.ll
    LLVM :: CodeGen/X86/win32-pic-jumptable.ll
    LLVM :: CodeGen/X86/x32-va_start.ll
    LLVM :: CodeGen/X86/x86-shrink-wrap-unwind.ll
    LLVM :: CodeGen/X86/x86-shrink-wrapping.ll
    LLVM :: CodeGen/XCore/ashr.ll
    LLVM :: CodeGen/XCore/codemodel.ll
    LLVM :: CodeGen/XCore/events.ll
    LLVM :: CodeGen/XCore/indirectbr.ll
    LLVM :: DebugInfo/AMDGPU/dbg-value-sched-crash.ll
    LLVM :: DebugInfo/COFF/frameproc-flags.ll
    LLVM :: DebugInfo/X86/earlydup-crash.ll
    LLVM :: MC/ARM/data-in-code.ll
    LLVM :: ThinLTO/X86/callees-metadata.ll
    LLVM :: Transforms/LoopStrengthReduce/AArch64/small-constant.ll


I suspect this just needs to call analyzeBranch on TailBB before making any
changes. Once the terminators of TailBB are cloned into PredBB, they should be
the same so it should be equivalent?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190606/2b87bbc9/attachment-0001.html>


More information about the llvm-bugs mailing list