Nikita Popov 5887006510
[IR] Forbid mixing condition and operand bundle assumes (#160460)
Assumes either have a boolean condition, or a number of attribute based
operand bundles. Currently, we also allow mixing both forms, though we
don't make use of this in practice. This adds additional complexity for
code dealing with assumes.

Forbid mixing both forms, by requiring that assumes with operand bundles
have an i1 true condition.
2025-09-24 12:42:50 +02:00

34 lines
1.0 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt -passes=alignment-from-assumptions -S < %s | FileCheck %s
; The alignment assumption is a global, which has users in a different
; function. Test that in this case the dominator tree is only queried with
; blocks from the same function.
@global = external constant [192 x i8]
define void @fn1() {
; CHECK-LABEL: define void @fn1() {
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr @global, i64 1) ]
; CHECK-NEXT: ret void
;
call void @llvm.assume(i1 true) [ "align"(ptr @global, i64 1) ]
ret void
}
define void @fn2() {
; CHECK-LABEL: define void @fn2() {
; CHECK-NEXT: ret void
; CHECK: [[LOOP:.*]]:
; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds i8, ptr @global, i64 0
; CHECK-NEXT: [[LOAD:%.*]] = load i64, ptr [[GEP]], align 1
; CHECK-NEXT: br label %[[LOOP]]
;
ret void
loop:
%gep = getelementptr inbounds i8, ptr @global, i64 0
%load = load i64, ptr %gep, align 1
br label %loop
}