brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1004 B · f4baa2f Raw
36 lines · plain
1; RUN: llc < %s -verify-machineinstrs | FileCheck %s2 3; Wasm does not currently support function addresses with offsets, so we4; shouldn't try to create a folded SDNode like (function + offset). This is a5; 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 bug10declare hidden void @ham(ptr)11 12define void @bar(ptr %ptr) {13bb1:14  br i1 undef, label %bb3, label %bb215 16bb2:17  ; While lowering this switch, isel creates (@ham + 1) expression as a course18  ; of range optimization for switch, and tries to fold the expression, but19  ; wasm does not support with function addresses with offsets. This folding20  ; should be disabled.21  ; CHECK:      i32.const  ham22  ; CHECK-NEXT: i32.const  123  ; CHECK-NEXT: i32.add24  switch i32 ptrtoint (ptr @ham to i32), label %bb4 [25    i32 -1, label %bb326    i32 0, label %bb327  ]28 29bb3:30  unreachable31 32bb4:33  %tmp = load i8, ptr %ptr34  unreachable35}36