Unlike every other analysis and transform, simplifyInstruction permitted operating on instructions which are not inserted into a function. This created an edge case no other code needs to really worry about, and limited transforms in cases that can make use of the context function. Only the inliner and a handful of other utilities were making use of this, so just fix up these edge cases. Results in some IR ordering differences since cloned blocks are inserted eagerly now. Plus some additional simplifications trigger (e.g. some add 0s now folded out that previously didn't).
28 lines
872 B
LLVM
28 lines
872 B
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
|
|
; RUN: opt < %s -passes=inline -S | FileCheck %s
|
|
|
|
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
|
target triple = "x86_64-unknown-linux-gnu"
|
|
|
|
define ptr @callee() alwaysinline {
|
|
; CHECK-LABEL: define ptr @callee
|
|
; CHECK-SAME: () #[[ATTR0:[0-9]+]] {
|
|
; CHECK-NEXT: [[TMP1:%.*]] = call ptr @llvm.strip.invariant.group.p0(ptr null)
|
|
; CHECK-NEXT: ret ptr [[TMP1]]
|
|
;
|
|
%1 = call ptr @llvm.strip.invariant.group.p0(ptr null)
|
|
ret ptr %1
|
|
}
|
|
|
|
define ptr @caller() null_pointer_is_valid {
|
|
; CHECK-LABEL: define ptr @caller
|
|
; CHECK-SAME: () #[[ATTR1:[0-9]+]] {
|
|
; CHECK-NEXT: [[TMP1:%.*]] = call ptr @llvm.strip.invariant.group.p0(ptr null)
|
|
; CHECK-NEXT: ret ptr [[TMP1]]
|
|
;
|
|
%1 = call ptr @callee()
|
|
ret ptr %1
|
|
}
|
|
|
|
declare ptr @llvm.strip.invariant.group.p0(ptr)
|