Skip to content

Conversation

RiverDave
Copy link
Collaborator

Two things:

  1. Added some NYI placeholders
  2. Tests for i386(x86) are pending as we haven't dealt with that triple yet as compared to CG.

Copy link

⚠️ undef deprecator found issues in your code. ⚠️

You can test this locally with the following command:
git diff -U0 --pickaxe-regex -S '([^a-zA-Z0-9#_-]undef[^a-zA-Z0-9_-]|UndefValue::get)' 4820d600ed3362744372983068495f086c9a0659 2fae69746794a169685714e426f9f2c7bf343832 clang/test/CIR/CodeGen/X86/x86_64-xsave.c clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp

The following files introduce new uses of undef:

  • clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp

Undef is now deprecated and should only be used in the rare cases where no replacement is possible. For example, a load of uninitialized memory yields undef. You should use poison values for placeholders instead.

In tests, avoid using undef and having tests that trigger undefined behavior. If you need an operand with some unimportant value, you can add a new argument to the function and use that instead.

For example, this is considered a bad practice:

define void @fn() {
  ...
  br i1 undef, ...
}

Please use the following instead:

define void @fn(i1 %cond) {
  ...
  br i1 %cond, ...
}

Please refer to the Undefined Behavior Manual for more information.

@RiverDave
Copy link
Collaborator Author

⚠️ undef deprecator found issues in your code. ⚠️

You can test this locally with the following command:
The following files introduce new uses of undef:

  • clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp

Undef is now deprecated and should only be used in the rare cases where no replacement is possible. For example, a load of uninitialized memory yields undef. You should use poison values for placeholders instead.

In tests, avoid using undef and having tests that trigger undefined behavior. If you need an operand with some unimportant value, you can add a new argument to the function and use that instead.

For example, this is considered a bad practice:

define void @fn() {
  ...
  br i1 undef, ...
}

Please use the following instead:

define void @fn(i1 %cond) {
  ...
  br i1 %cond, ...
}

Please refer to the Undefined Behavior Manual for more information.

Do we want parity with CG for these undef intrinsics given this deprecation?

@bcardosolopes
Copy link
Member

Do we want parity with CG for these undef intrinsics given this deprecation?

Yep, for this specific instance we are better off ignoring the message (the intrinsics are still there in OG).

@bcardosolopes bcardosolopes changed the title [CIR][CIRGen][Builtin][X86] Lower -xsave related intrinsics [CIR][CIRGen][Builtin][X86] Lower xsave related intrinsics Jun 26, 2025
@bcardosolopes bcardosolopes merged commit ad9389c into llvm:main Jun 26, 2025
9 of 10 checks passed
@RiverDave RiverDave deleted the lower-xsave branch July 6, 2025 00:11
terapines-osc-cir pushed a commit to Terapines/clangir that referenced this pull request Sep 2, 2025
Two things:

1. Added some NYI placeholders
2. Tests for i386(x86) are pending as we haven't dealt with that triple
yet as compared to CG.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants