1; RUN: llc < %s -verify-machineinstrs | FileCheck %s 2 3; Wasm does not currently support function addresses with offsets, so we 4; shouldn't try to create a folded SDNode like (function + offset). This is a 5; regression test for the folding bug and this should not crash in MCInstLower. 6 7target triple = "wasm32-unknown-unknown" 8 9; 'hidden' here should be present to reproduce the bug 10declare hidden void @ham(ptr) 11 12define void @bar(ptr %ptr) { 13bb1: 14 br i1 undef, label %bb3, label %bb2 15 16bb2: 17 ; While lowering this switch, isel creates (@ham + 1) expression as a course 18 ; of range optimization for switch, and tries to fold the expression, but 19 ; wasm does not support with function addresses with offsets. This folding 20 ; should be disabled. 21 ; CHECK: i32.const ham 22 ; CHECK-NEXT: i32.const 1 23 ; CHECK-NEXT: i32.add 24 switch i32 ptrtoint (ptr @ham to i32), label %bb4 [ 25 i32 -1, label %bb3 26 i32 0, label %bb3 27 ] 28 29bb3: 30 unreachable 31 32bb4: 33 %tmp = load i8, ptr %ptr 34 unreachable 35} 36