This is an archive of the discontinued LLVM Phabricator instance.

Test case for patch D52002
AbandonedPublic

Authored by ayonam on Dec 19 2018, 1:39 PM.

Details

Summary

This is a test case for the patch D52002. It checks whether a compare followed by a branch is being generated or not if the default is unreachable. The patch D52002 implements the removal of this compare and branch when the default case is unreachable for a switch statement.

Diff Detail

Event Timeline

ayonam created this revision.Dec 19 2018, 1:39 PM
ayonam retitled this revision from Test case for patches D52002 to Test case for patch D52002.Dec 19 2018, 1:40 PM
hans added a comment.Dec 20 2018, 2:18 AM

Looks promising. Please make the suggested changes, and please move this patch into D52002. The functionality change and the test should be in the same patch.

test/CodeGen/AArch64/switch-unreachable-default.ll
1

I think for a simple case like this, it should be possible to write the assertions manually.

10

No need for dso_local, nocapture, readonly, local_unnamed_addr, or the attributes in #0. Please remove them to simplify the test.

13

Having these checks before the function starts doesn't look right.

I think the test should be something like

CHECK-LABEL: fn:
CHECK-NOT: sub
CHECK-NOT: cmp
CHECK: load jump target
CHECK: branch to jump target

41

I'd suggest just taking the switch argument directly as an argument of the function. I.e. make %0 an i8 instead of i32* above, and switch on that directly. Then there's no need to load, trunc, etc, and that will simplify the test.

42

I prefer to use explicit names for the basic blocks, i.e. instead fo %4, call it %default maybe, and then %case0, %case1, etc. for the case blocks.

llvm-commits is not CC'ed on this revision; llvm-commits is the official record for all reviews, so any patch posted without CC'ing llvm-commits essentially doesn't exist. It looks like you're going to abandon this anyway, but please be more careful in the future.

Looks promising. Please make the suggested changes, and please move this patch into D52002. The functionality change and the test should be in the same patch.

Done.

llvm-commits is not CC'ed on this revision; llvm-commits is the official record for all reviews, so any patch posted without CC'ing llvm-commits essentially doesn't exist. It looks like you're going to abandon this anyway, but please be more careful in the future.

Thanks Eli for bringing this to my notice. I wasn't aware of this aspect. I thought, the reviews here automatically become the record and I just need to quote the review ID while committing the code. Anyway, as you said, I'll be abandoning this patch and have already moved it to 52002. Thanks again.

ayonam abandoned this revision.Jan 13 2019, 9:13 PM

This test case has been subsumed in D52002