Index: clang/lib/CodeGen/CGCall.cpp =================================================================== --- clang/lib/CodeGen/CGCall.cpp +++ clang/lib/CodeGen/CGCall.cpp @@ -4538,10 +4538,11 @@ const auto *AlignmentCI = dyn_cast(Alignment); if (!AlignmentCI) return Attrs; - // We may legitimately have non-power-of-2 alignment here. - // If so, this is UB land, emit it via `@llvm.assume` instead. - if (!AlignmentCI->getValue().isPowerOf2()) + // Non power-of-2 alignment is UB and rejected by the IR verifier. + if (!AlignmentCI->getValue().isPowerOf2()) { + AA = nullptr; return Attrs; + } llvm::AttributeList NewAttrs = maybeRaiseRetAlignmentAttribute( CGF.getLLVMContext(), Attrs, llvm::Align( Index: clang/test/CodeGen/non-power-of-2-alignment-assumptions.c =================================================================== --- clang/test/CodeGen/non-power-of-2-alignment-assumptions.c +++ clang/test/CodeGen/non-power-of-2-alignment-assumptions.c @@ -21,7 +21,6 @@ // CHECK-NEXT: [[ALIGN_ADDR:%.*]] = alloca i32, align 4 // CHECK-NEXT: store i32 [[ALIGN:%.*]], i32* [[ALIGN_ADDR]], align 4 // CHECK-NEXT: [[CALL:%.*]] = call i8* @alloc(i32 7) -// CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(i8* [[CALL]], i64 7) ] // CHECK-NEXT: ret void // void t1(int align) {