Page MenuHomePhabricator

add assert to confirm input is valid for pass HardwareLoops
Needs RevisionPublic

Authored by XinWang10 on Fri, Mar 17, 2:26 AM.

Details

Reviewers
samparker
fhahn
Summary

For a function TryConvertLoop in pass HardwareLoops, wrong input arguments will
lead to crash. In line 342, compiler want to get something from
HWLoopInfo.CountType, which depends on if argument Bitwidth is given, if not,
will crash.
Add an assert is convenient for me.

Diff Detail

Unit TestsFailed

TimeTest
500 msx64 debian > LLVM.CodeGen/ARM::branch-on-zero.ll
Script: -- : 'RUN: at line 2'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/llc -mtriple thumbv6m-none-eabi -o - /var/lib/buildkite-agent/builds/llvm-project/llvm/test/CodeGen/ARM/branch-on-zero.ll | /var/lib/buildkite-agent/builds/llvm-project/build/bin/FileCheck /var/lib/buildkite-agent/builds/llvm-project/llvm/test/CodeGen/ARM/branch-on-zero.ll --check-prefix=CHECK-V6M
790 msx64 debian > LLVM.CodeGen/ARM::fpclamptosat.ll
Script: -- : 'RUN: at line 2'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/llc -mtriple=thumbv6m-none-eabi -float-abi=soft /var/lib/buildkite-agent/builds/llvm-project/llvm/test/CodeGen/ARM/fpclamptosat.ll -o - | /var/lib/buildkite-agent/builds/llvm-project/build/bin/FileCheck /var/lib/buildkite-agent/builds/llvm-project/llvm/test/CodeGen/ARM/fpclamptosat.ll --check-prefixes=SOFT
360 msx64 debian > LLVM.CodeGen/PowerPC::2006-12-07-SelectCrash.ll
Script: -- : 'RUN: at line 1'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/llc -verify-machineinstrs < /var/lib/buildkite-agent/builds/llvm-project/llvm/test/CodeGen/PowerPC/2006-12-07-SelectCrash.ll -mtriple=ppc64--
390 msx64 debian > LLVM.CodeGen/PowerPC::2007-05-14-InlineAsmSelectCrash.ll
Script: -- : 'RUN: at line 1'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/llc -verify-machineinstrs < /var/lib/buildkite-agent/builds/llvm-project/llvm/test/CodeGen/PowerPC/2007-05-14-InlineAsmSelectCrash.ll
380 msx64 debian > LLVM.CodeGen/PowerPC::2007-11-16-landingpad-split.ll
Script: -- : 'RUN: at line 2'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/llc -simplifycfg-require-and-preserve-domtree=1 < /var/lib/buildkite-agent/builds/llvm-project/llvm/test/CodeGen/PowerPC/2007-11-16-landingpad-split.ll | /var/lib/buildkite-agent/builds/llvm-project/build/bin/FileCheck /var/lib/buildkite-agent/builds/llvm-project/llvm/test/CodeGen/PowerPC/2007-11-16-landingpad-split.ll
View Full Test Results (257 Failed)

Event Timeline

XinWang10 created this revision.Fri, Mar 17, 2:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptFri, Mar 17, 2:26 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
XinWang10 requested review of this revision.Fri, Mar 17, 2:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptFri, Mar 17, 2:26 AM
samparker accepted this revision.Fri, Mar 17, 3:15 AM

Okay, thanks.

This revision is now accepted and ready to land.Fri, Mar 17, 3:15 AM
fhahn added a subscriber: fhahn.Fri, Mar 17, 3:33 AM
fhahn added inline comments.
llvm/lib/CodeGen/HardwareLoops.cpp
330

It shouldn't be possible to trigger an assert when passing arguments to the pass. If there's an invalid combination, it should be handled gracefully, e.g. bailing out without doing anything (together with a debug message perhaps) or using a sane default value if it makes sense.

fhahn requested changes to this revision.Fri, Mar 17, 3:34 AM

Looks like multiple existing tests are triggering the assert and are failing.

This revision now requires changes to proceed.Fri, Mar 17, 3:34 AM